[theme-reviewers] Image Resizing
Philip M. Hofer (Frumph)
philip at frumph.net
Sat Feb 12 01:38:10 UTC 2011
I would accept this method as long as it passes security reviews. The problem with timthumb after all is said and done really boiled down to security more so then anything else, else being the implementation. What you described below constitutes a very valid situational usage for image resizing functionality and very well thought out I might add.
----- Original Message -----
From: Sayontan Sinha
To: theme-reviewers at lists.wordpress.org
Sent: Friday, February 11, 2011 5:33 PM
Subject: [theme-reviewers] Image Resizing
Hi,
At the risk of flogging a dead horse I would like to venture a few questions about image resizing. I know that this topic has done the rounds several times, but I just wanted some clarity before uploading the next version of my theme.
I was using TimThumb for resizing, which I eliminated in my upcoming release. To do so, however, I had to use a few tricks:
1.. I am using the concept of registered image sizes. So if you set a custom size for an image, it is being added using the add_image_size function.
2.. Now, considering the case where a size change is being registered after the image has been uploaded, I am broadly using the method outlined http://core.trac.wordpress.org/ticket/15311.
3.. Note that for historical reasons I have functionality similar to the "Get the Image" plugin in my code, whereby you could retrieve images based on the featured image, or a custom field or an attachment or an embedded URL. So it is imperative to have some kind of resizing functionality that works above and beyond the native WP resizing capabilities (which I am anyway using). This is where the above script comes really handy, but needs a good few modifications. To cite a few examples:
1.. I have made the method work for external URLs, plus the size parameters are actually based on the registered sizes and not "GET" parameters.
2.. The resizing is only invoked if an image of "intermediate" size (the fourth parameter of wp_get_attachment_image_src()) is not returned by the post thumbnail functionality. Also note that due to this means I cannot use the_post_thumbnail by itself, but I have to use wp_get_attachment_image_src(), which is called by wp_get_attachment_image(), which is called by get_the_post_thumbnail(), which in turn is called by the_post_thumbnail.
The result of the above is a seamless transition (hopefully) from my previous approach that used TimThumb to the current approach. The reason I have gone this route is so that users don't freak out when they see their images have not been correctly resized. Suggesting to everyone that they have to run a plugin every time they decide to change their image sizes seems to be fraught with the risk of being lynched.
Is this going to be acceptable for a review? I know that it is probably difficult to say without actually seeing the code, but I thought I should try my luck.
Regards,
Sayontan.
--
Sayontan Sinha
http://mynethome.net | http://mynethome.net/blog
--
Beating Australia in Cricket is like killing a celebrity. The death gets more coverage than the crime.
------------------------------------------------------------------------------
_______________________________________________
theme-reviewers mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20110211/9a18e89a/attachment-0001.htm>
More information about the theme-reviewers
mailing list