function image_insert in Image 5
Same name and namespace in other branches
- 5.2 image.module \image_insert()
- 6 image.module \image_insert()
Implementation of hook_insert
File
- ./
image.module, line 648
Code
function image_insert($node) {
// Derivative images that aren't needed are set to the original file. Make
// note of the current path before calling _image_insert() because if it's
// in the temp directory it'll be moved. We'll need it later to determine
// which derivative images need to be saved with _image_insert().
$original_path = $node->images[IMAGE_ORIGINAL];
// Save the original first so that it if it's moved the derivatives are
// placed in the correct directory.
_image_insert($node, IMAGE_ORIGINAL, $original_path);
$sizes = image_get_derivative_sizes($node->images[IMAGE_ORIGINAL]);
foreach ($sizes as $key => $size_info) {
if (!empty($node->images[$key]) && $node->images[$key] != $original_path) {
_image_insert($node, $key, $node->images[$key]);
}
}
}