![]() |
|
Externally Generate Thumbnails - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: Externally Generate Thumbnails (/thread-5852.html) |
Externally Generate Thumbnails - andermic - 2009-09-15 I really like my zenphoto gallery (http://www.andermic.com/photos/) and I just started a "blog" to write about my photography. I would like to post images within the blog posts, but instead of uploading with the blog software and having to maintain two sets of images, I was wondering if it would be simple enough for me to link to a page that can get thumbnails of certain sizes for the blog. I started to write a script that caches the images and gets whatever size I ask for, but once again I really would rather not have to maintain two sets. Here's the code I started if it helps to describe what I am trying to do. $album = $_GET["album"]; $image = $_GET["image"]; $new_width = $_GET["size"]; if (fileexists('cache/'. $album .'/'. $image .''. $new_width .'.jpg')) { $tmpimg = imagecreatefromjpeg('cache/'. $album .'/'. $image .''. $new_width .'.jpg'); } else { $file = imagecreatefromjpeg($album .'/'. $image); $width = imagesx( $file ); $height = imagesy( $file ); $new_height = floor($height * ($new_width/$width)); $tmp_img = imagecreatetruecolor( $new_width, $new_height ); imagecopyresized( $tmp_img, $file, 0, 0, 0, 0, $new_width, $new_height, $width, $height ); if (!is_dir('cache/'. $album)) {
} imagejpeg($tmpimg, 'cache/'. $album .'/'. $image .''. $new_width .'.jpg', 100); } header('Content-Type: image/jpeg'); imagejpeg($tmp_img, NULL, 100); imagedestroy($file); imagedestroy($tmp_img); ` Externally Generate Thumbnails - acrylian - 2009-09-15 What system do you use for your blog? If wordpress there are several third party tools on our extensions section. If not Wordpress this way is the best to add Zenphoto functionality to external sites: Externally Generate Thumbnails - andermic - 2009-09-15 I just found out that i.php looks to be the answer to my question. I'm going to read that script and see what I can come up with. Externally Generate Thumbnails - acrylian - 2009-09-15 Right, you can also use that directly. |