PHP Thumb » Help & Bugs

save multiple thumbnails

(4 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 1 year 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 1 year 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 12 months 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 10 months ago #

RSS feed for this topic

Reply

You must log in to post.