Support > cpg1.5 plugin contributions
Custom Thumbnail for cpg1.5.x
Templarart:
"The thumbnail will always be resized to the values you specified in Coppermine's config. At least this is how the plugin should work by design."
Right, that's a given - let's say 120 on the longest side. What I'm wondering about is the proportions. As I look at the thumbs in my gallery I see squares (120x120), long rectangles (120xwhatever) and tall rectangles (whateverx120). I was trying to substitute a square (120x120) for a tall rectangle (70x120). When I uploaded a square thumb (120x120), it was squished into the proportions of the original thumb (70x120). If this is unavoidable... oh well, but I was hoping it was just a mistake I was making.
Thank you for your prompt reply.
Αndré:
Please post a link to your gallery, especially to a thumbnail which doesn't have the correct size after you updated it with the plugin.
Alu:
Is there a way to prevent it from converting it to .jpg if I upload .png?
Αndré:
--- Quote from: Alu on April 18, 2011, 11:12:28 am ---Is there a way to prevent it from converting it to .jpg if I upload .png?
--- End quote ---
Open codebase.php, find
--- Code: --- if (!is_image($row['filename'])) {
$path_parts = pathinfo($row['filename']);
$row['filename'] = str_replace($row['filename'], basename($row['filename'], '.'.$path_parts['extension']).'.jpg', $row['filename']);
}
--- End code ---
and replace with
--- Code: --- if (!is_image($row['filename'])) {
$imginfo = cpg_getimagesize($fileupload['tmp_name']);
switch ($imginfo[2]) {
case '1': $extension = '.gif'; break;
case '3': $extension = '.png'; break;
default: $extension = '.jpg'; break;
}
$path_parts = pathinfo($row['filename']);
$row['filename'] = str_replace($row['filename'], basename($row['filename'], '.'.$path_parts['extension']).$extension, $row['filename']);
}
--- End code ---
Note: it only works if you upload a custom thumbnail for non-images, as Coppermine assumes the same file type for images and their thumbnails. Additionally if you upload more than one custom thumbnail for the same file (with different extensions) more than one thumbnail for the same file may exists. In that case the standard routine of detecting custom thumbnails applies (GIF -> PNG -> JPG).
WillyWonderDog:
Plugin works great. Thank you. Of course I have a question though, what is the proper way to remove a custom thumbnail? I see how to change the custom thumbnail if desired by uploading a new image for it, but I can't figure out how to properly remove a custom thumbnail (and let it go back to the system thumbnail).
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version