Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Multi Image Upload and Multi Manipulation
  • I asked followup questions in another post, but not sure if it will get a reply since it's marked as 'answered' i just noticed... anyway, here is the updated situation..


    I am trying to upload multiple images and have them resized and saved.

    I have been trying for a few days to do this, but from what would seem right, I was only ever able to get the first image in the set to size only on the first manipulation.

    What I have that is currently working is:

    Upload::save();
          foreach (Upload::get_files() as $key=>$file) {
              Image::load($file['saved_to'].$file['saved_as'])
                          ->preset('280x280', DOCROOT.'/../images_280x280/'.$file['saved_as']);
              Image::load($file['saved_to'].$file['saved_as'])
                          ->preset('800', DOCROOT.'/../images_800/'.$file['saved_as']);

    What this is doing is:

    Upload::save()   (saves all the images uploaded to the 'path' specified in the upload.php config.
    Each Image::load then gets that image and makes the changes and saves it to the new location per the dir it's to go in.

    This does not seem right. I have to upload, then it copies the tmp file to the dir I set in the 'path' of upload.config and then for each of the sizing item::load operations, it copies it from the 'path' dir to the new dirs. So I end up with at least three versions of the image.

    I would think that I should just be able to use the files directly from the 'tmp' dir, no?

    I tried leaving the 'path' set to '', also tried commenting it out and all the times, I would get 'filetype not valid' errors

    I was setting the Image::load($file['file'], false, 'jpg') ... but that was not working at all.

    What am I doing wrong?

    thanks.


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!