PHP Thumb » Help & Bugs

save multiple thumbnails

(6 posts)
  1. maniac
    Member

    Hi, I want to save multiple thumbnails from each image with several sizes:

    $image = PhpThumbFactory::create($image);
    $thmb_panel = $image->adaptiveResize(79,79)->save($destino."/thmb.jpg");
    $thmb_fend = $image->adaptiveResize(237, 180)->save($destino."/fend.jpg");

    The problem is $thmb_fend saves with 79x79px like $thmb_panel.

    Any suggestions?
    Thanks for the great class :)

    Posted 2 years ago #
  2. Well, since adaptive resizing is somewhat destructive I would recommend re-initializing the class for the best results. However, you should be able to get away with perfectly acceptable results by saving $thmb_fend first and then $thmb_panel.

    I also suppose that I could add a "reset" kind of function that would restore the original image so you could do something like:
    $thmb_fend = $image->reset()->adaptiveResize(237, 180)->save($destino."/fend.jpg");

    If this is a good alternative, I'll add it to the roadmap for the next release.

    Posted 2 years ago #
  3. qd1
    Member

    hi!
    It doesn't matter wether one uses adaptiveResize or just resize
    code below behaves the same way first post describes
    $thumb = PhpThumbFactory::create($save_path.'originals/'.$file_name);
    $thum_thumbnail = $thumb->resize(100, 100)->save($save_path.'thumbnails/'.'thumb_'.$file_name);
    $thumb_preview = $thumb->resize(400, 400)->save($save_path.'preview/'.'prev_'.$file_name);

    so that may be a bug

    Posted 2 years ago #
  4. d1uluv2h8
    Member

    A reset function would be great, i also have a situation where i have to resize an image twice to get two thumbs with different dimensions.

    Should I file an enhancement ticket? :)

    Posted 2 years ago #
  5. rumeau
    Member

    Hey i´ve been using this library a few times before and always had to create new instances of the class to create multiple thumbnails.

    I see that this post has a year already are you considering adding a reset method to the class?

    if not could you advise on how to create a patch to do this. im not very skill with this to do it on my own, but i could manage to get it right if you give me some advices on where should i start.

    Thanks

    Posted 1 year ago #
  6. ravisoni6262
    Member

    thanks rumeau you have suggested great idea!

    Posted 7 months ago #

RSS feed for this topic

Reply

You must log in to post.