- $str_image = $ph->imageString();
- $smallest = 0;
-
- $r = q("INSERT INTO `photo` ( `uid`, `resource-id`, `created`, `edited`, `filename`,
- `height`, `width`, `data`, `scale` )
- VALUES ( %d, '%s', '%s', '%s', '%s', %d, %d, '%s', 0 )",
- intval($_SESSION['uid']),
- dbesc($hash),
- datetime_convert(),
- datetime_convert(),
- dbesc(basename($filename)),
- intval($height),
- intval($width),
- dbesc($str_image));
- if($r)
- notice("Image uploaded successfully." . EOL);
- else
- notice("Image upload failed." . EOL);
-
- if($width > 640 || $height > 640) {
- $ph->scaleImage(640);
- $str_image = $ph->imageString();
- $width = $ph->getWidth();
- $height = $ph->getHeight();
-
- $r = q("INSERT INTO `photo` ( `uid`, `resource-id`, `created`, `edited`, `filename`,
- `height`, `width`, `data`, `scale` )
- VALUES ( %d, '%s', '%s', '%s', '%s', %d, %d, '%s', 1 )",
- intval($_SESSION['uid']),
- dbesc($hash),
- datetime_convert(),
- datetime_convert(),
- dbesc(basename($filename)),
- intval($ph->getHeight()),
- intval($ph->getWidth()),
- dbesc($ph->imageString())
- );
- if($r === false)
- notice("Image size reduction (640) failed." . EOL );
- else
- $smallest = 1;
- }
-
- $a->config['imagecrop'] = $hash;
- $a->config['imagecrop_resolution'] = $smallest;
- $a->page['htmlhead'] .= file_get_contents("view/crophead.tpl");
- return;