[wp-hackers] avoiding of using phpThumb / timThumb
kkarpieszuk at gmail.com
Thu Mar 31 18:12:29 UTC 2011
On Thu, Mar 31, 2011 at 7:38 PM, Otto <otto at ottodestruct.com> wrote:
> Using add_image_size is indeed the correct way to go, but the real question
> is why would you need "tens" of image sizes?
the answer is: customer needs this :)
> Are you really displaying the
> same image in ten different places, ten different sizes?
not at all. in most of cases images uploaded to medi library will be
displayed in two sizes: 'large' and 'thumbnail'
but customer want to use those images from library also in other
custom post types, in widgets, in jquery-cycle etc.
please look at this prototype of main page:
http://awesomescreenshot.com/08eak5t82 all full color images which you
see, owner of the site will choose from already uploaded to media
now i counted that one image could be displayed in at least 9 sizes.
but most of images (i think 95%) will be displayed only in custom post
type 'gallery' in only two sizes mentioned above.
generating 9 image sizes during the image upload process (in
situation, when only two sizes will be displayed for sure, and next 7
maybe) will be unefficient for server
doing this in way which you described is also not a good way: my
customer is pedant and always see when i just rescale image in
width="" hieght="" html parameters (this changes dimensions) :) i
tried this and this doesnt work
i just wanted to find way to move rescale process from upload action
to the moment when special size is really neccesary and plugin
mentioned by Scribu is perfect
> If some of these sizes are similar or close enough together, then you can
> use a combination of image resizing and browser resizing. Let's say I only
> have it generate three image sizes normally. Then I try to display an image,
> but instead of passing it a size, I pass it an array(width,height). This
> works, but what it does internally is that it looks at what image sizes it
> has, grabs the one that's closest (but bigger), does the scaling math, and
> then pops back an IMG tag with the width and height set correctly, but using
> that slightly larger image. This makes the browser itself scale the image
> down, giving me the best approximation and not requiring me to do all the
> server resizing and such.
> Realistically, you're not going to run out of execution time with "tens" of
> image sizes though. It can generally handle it just fine. I've gone up to
> six for a site with no significant problems. Resizing isn't a slow
> operation, it's just heavy on temporary memory usage.
> On Thu, Mar 31, 2011 at 11:04 AM, Konrad Karpieszuk
> <kkarpieszuk at gmail.com>wrote:
>> on site which i create now, i will have many areas with photos and
>> those photos must be rescaled befor displaying. normally to do this i
>> use phpThumb with ?w=100&h=200 etc.
>> Is there any other way to do this using wordpress core functions?
>> I thought to use add_image_size to automatically rescale image when
>> is uploaded. but if i choose this way, i am affraid that this will not
>> work. i should register tens of image sizes. when smb will upload
>> photo i can expect that when wordpress will save this image with
>> rescaled many variants in one moment php will exceed memory limit.
>> is there any function which i can use in way like phpThumb? this
>> should rescale image (with crop option) but before this check if
>> already rescaled version exists
>> (en) regards / (pl) pozdrawiam
>> Konrad Karpieszuk
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
(en) regards / (pl) pozdrawiam
More information about the wp-hackers