• damian5000

    (@damian5000)


    To make a long story short, is there any plugin or way to force a generation of thumbnail when requested by the post if it doesn’t exist?

    I don’t mean to regenerate at current settings. I want WordPress to generate a thumbnail if it doesn’t exist when frontend requests it.

    Example, post calls horsepicture-150×155.jpg, but it doesn’t exist, so it creates it from horsepicture.jpg (which has already been uploaded obviously).

    I tried a two-year old plugin for this, but it crashed the website.

Viewing 4 replies - 1 through 4 (of 4 total)
  • salsaturation

    (@salsaturation)

    Why don’t you define the thumbnails sizes in functions.php https://codex.wordpress.org/Post_Thumbnails#Thumbnail_Sizes then use a plugin to regenerate all the images eg http://wordpress.org/plugins/search.php?q=regenerate+thumbnail

    Thread Starter damian5000

    (@damian5000)

    I was trying to keep a long story short :). But, I guess I’ll explain. I used a plugin that created a watermark and silly me, I made it so the watermark was outside the image, not inline… Which changes the size of the images. At some points I’ve used the plugin, and other times not. Many of the original images are watermarked as well, but many aren’t. So when recreating the thumbnails, some will be properly sized to the hard-coded inserts, some won’t. Many will be recreated with a double-watermark. I’d have to regenerate with the plugin on and with the plugin off creating hundreds upon hundreds of unneeded images. These are just a few of the considerations, but you get the idea.

    It’s really a mess man.

    Ideally, I’d like to crop all the watermarks off the original images that have it, and then recreate the thumbnails. But because most of the images were inserted with the external watermark, the image wouldn’t show because of the hard-coded size difference in the posts. This is where auto creating the image that doesn’t exist comes in. But even that is a problem, because even if it was possible, the image would be skewed.

    These are just some of the considerations. It’s a real mess.

    It’s too bad it can’t just call an image based on a size call – small or medium or custom-size name instead of the hard-coded links. EG horsepicture-small. In that case I could do as previously mentioned, crop off the watermark and then recreate the thumbnails.

    salsaturation

    (@salsaturation)

    creating hundreds upon hundreds of unneeded images.

    Why don’t you backup all the files delete the thumbnails but leave the originals, define the thumbnail sizes and rerun the regenerator script

    or look at this solution

    http://www.dezzain.com/wordpress-tutorials/how-to-check-if-custom-image-size-exists-in-wordpress/

    Thread Starter damian5000

    (@damian5000)

    I think you missed the whole point to what I wrote. The size was changed due to the watermark and because the watermark exists on the original image on some pictures, but not on others. And if you run it with the watermark at the same settings, it adds the watermark again. Creating a double watermark and if you run it without the watermark plug in engaged, they won’t be the same size. Actually, either way, it wouldn’t end up the same size, because the original image has the watermark on it externally. So for example a 400×300 with the watermark may be 400×310 when it creates the thumbnail without the watermark plugin engaged from that original image, the size wont be correct because when the original thumbnail was put in the post, it had the watermark. If doing it WITH the watermark plugin, then it still won’t be correct because it’s making a thumbnail of the watermarked original, not the true original as it was originally planted in the post.

    Everything is okay functionally now. I had all the images from the previous theme. It’s just a mess with hundreds of unneeded pics because of the regeneration.

    My main goal is to remove the watermark from all images. Then reupload the main images (without a size changing watermark). That’s only 10% of the battle though. As I said, even if wordpress were to be able to auto-generate the requested image, it would be skewed because it would have the external watermarked size, not the correct picture size hard-coded into the posts.

    I basically want to get this all cleaned up and neat so I never have to worry about it again. Maybe I’ll have to go through 500 posts and replace all the images. Jeez.

    Really would be much simpler if WordPress requested the pic based on size name as opposed to actual size. I don’t know if this is at all possible or not. Possible with php conditionals based on size and code to auto generate the missing pic… eg if pic is missing & requested pic width is < 200 and height is less than < 400 then generate such-and-such a thumbnail from original & replace img code. But this is well beyond me and I’m probably the only numbnut who decided to put a watermark outside the image. I just didn’t realize the implications at the time.

    I’ve now let go of the practice. But my concern is for the future. Imagine if I had to recreate thumbnails again with new sizes, some with external watermark, some with internal, some with no watermark. It’s unthinkable. So I’m trying to figure how to clean up this mess with the least amount of work. That seems to be cropping off the originals watermark, then going through 500 posts and replacing the images.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to force creation of thumbnail when image doesn't exist?’ is closed to new replies.