function _image_insert in Image 5
Same name and namespace in other branches
- 5.2 image.module \_image_insert()
- 6 image.module \_image_insert()
Moves temporary (working) images to the final directory and stores relevant information in the files table
3 calls to _image_insert()
- image_insert in ./
image.module - Implementation of hook_insert
- image_update in ./
image.module - Implementation of hook_update
- image_update_1 in ./
image.install - Update 4.5 to 4.6 or later.
File
- ./
image.module, line 1035
Code
function _image_insert(&$node, $size, $image_path) {
$original_path = $node->images[IMAGE_ORIGINAL];
if (file_move($image_path, _image_filename($original_path, $size))) {
// Update the node to reflect the actual filename, it may have been changed
// if a file of the same name already existed.
$node->images[$size] = $image_path;
$image_info = image_get_info($image_path);
$fid = db_next_id('{files}_fid');
db_query("INSERT INTO {files} (fid, nid, filename, filepath, filemime, filesize) VALUES (%d, %d, '%s', '%s', '%s', '%s')", $fid, $node->nid, $size, $image_path, $image_info['mime_type'], $image_info['file_size']);
db_query("INSERT INTO {file_revisions} (fid, vid, description, list) VALUES (%d, %d, '%s', %d)", $fid, $node->vid, '', 0);
}
}