Argazkiak inportatu (Estepanenak)

Lotutako hitzak berbaren dagokion sarreran erantsita azalduko dira.

'ekin=1')); } function ekin(){ $src = ''; $rows = explode("\n", $src); // $rows = array_slice($rows, 10); foreach($rows as $row){ list($nid, $author, $taken, $original_filename, $alt, $description) = explode("\t", $row); $path = $author == 'Estepan' ? 'tmp/Estepan/'.$original_filename.'.jpg' : 'tmp/Polpol/'.$original_filename.'.jpg'; if(!file_exists($path)){ $path = str_replace('.jpg', '.JPG', $path); } if(file_exists($path)){ $size = filesize($path); $notes = $row; list($taken_year, $taken_month, $taken_day) = explode('/', $taken); $original_filename = basename($path); db_query('INSERT INTO photo(alt, original_filename, status, author, web_source, description, notes, taken, taken_year, taken_month, taken_day, received, uid, size, width, height, thumb_width, thumb_height) VALUES ("%s", "%s", 1, "%s", "%s", "%s", "%s", "%s", %d, %d, %d, NOW(), 1, %d, %d, %d, %d, %d)', $alt, $original_filename, $author, $web_source, $description, $notes, $taken, $taken_year, $taken_month, $taken_day, $size, $width, $height, $thumb_width, $thumb_height); $phid = db_last_insert_id('photo', 'phid'); $imageinfo = getimagesize($path); $width = $imageinfo[0]; $height = $imageinfo[1]; $target_path = "sites/default/files/photo/2011/11/$phid.jpg"; if($width > 800 || $height > 800){ $original_path = str_replace('/photo/', '/photo/original/', $target_path); copy($path, $original_path); $ok = image_scale($path, $target_path, 800, 800); $imageinfo = getimagesize($target_path); $width = $imageinfo[0]; $height = $imageinfo[1]; } else { copy($path, $target_path); } $thumb_path = str_replace('/photo/', '/photo/thumb/', $target_path); $ok = image_scale($path, $thumb_path, 120, 120); $thumbinfo = getimagesize($thumb_path); $db_path = str_replace('sites/default/files/photo/', '', $target_path); db_query('UPDATE photo SET path = "%s", width = %d, height = %d, thumb_width = %d, thumb_height = %d WHERE phid = %d', $db_path, $width, $height, $thumbinfo[0], $thumbinfo[1], $phid); db_query('INSERT INTO photo_node(nid, phid) VALUES(%d, %d)', $nid, $phid); } else { drupal_set_message($path); } } } ?>
Batere ez.
Lotura berria erantsi