Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7830485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:15:24+00:00 2026-06-02T11:15:24+00:00

I can upload the image and resize with phpthumb, but how can i also

  • 0

I can upload the image and resize with phpthumb, but how can i also have the original image uploaded too?

     if ($this->getRequest()->isPost()) {
        $formData = $this->getRequest()->getPost();
            if ($form->isValid($formData)) {

            // upload the image
            if ($form->station_image->isUploaded()) {
                $form->station_image->receive();
                $station_image = '/upload/images/radio/' . basename($form->station_image->getFileName());
                //upload thumb
                include_once '../library/PhpThumb/ThumbLib.inc.php'; 
                    $thumb = PhpThumbFactory::create($form->station_image->getFileName());                                    
                    $thumb->resize(50, 50)->save($form->station_image->getFileName()); 
                  //thumb ends



            }else{
                echo 'cannot upload'. exit;
            }

My forms look like this

$station_image->setLabel('Upload File: ')
                        ->setDestination(APPLICATION_PATH.'/../public/upload/images/radio')
                        ->addValidator('Extension', false, 'jpg,png,gif')
                        ->addValidator('Size', false, 902400)
                        ->addValidator('Count', false, 1)
                        ->setRequired(false);

Please help me how to upload multiple thumbnail or how can i get the original file uploaded as well ? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T11:15:27+00:00Added an answer on June 2, 2026 at 11:15 am

    You are passing the original image to the constructor of PHPThumb:

    $thumb = PhpThumbFactory::create($form->station_image->getFileName());
    

    So $form->station_image->getFileName() is your original file. The problem is you are over-writing the original filename with the resized filename, try this:

    $thumb = PhpThumbFactory::create($form->station_image->getFileName());                                    
    $thumb->resize(50, 50)->save('/path/where/you/want/resized/image/to/go.png');
    

    — Update —

    Give this a try:

    if ($form->station_image->isUploaded()) {
    
        $form->station_image->receive();
        $station_image = '/upload/images/radio/' . basename($form->station_image->getFileName());
        //upload thumb
        include_once '../library/PhpThumb/ThumbLib.inc.php'; 
        $thumb = PhpThumbFactory::create($form->station_image->getFileName());
    
        // Notice this is using $station_image, which I assume is an accessible path
        // by your webserver                                    
        $thumb->resize(50, 50)->save($station_image); 
        //thumb ends
    
     }else{
    

    — Update —

    Try changing this:

     $station_image = '/upload/images/radio/' . basename($form->station_image->getFileName());
    

    To this:

     $station_image = '/upload/images/radio/thumb_' . basename($form->station_image->getFileName());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been doing research on image file upload security for a while but can't
I have a file upload class which returns an image resize object if the
When user upload image I resize that image in 3 different sizes. I can't
In a rather simple ASP.NET application where the user can upload a image, mostly
In my website, the user can upload a profile image. The website structure is
I can't seem to upload an image using Zend_Service_Nirvanix. Is it even possible? I
We have a CMS where people can upload images. We currently don't offer a
I have users that have several objects and can upload images for those objects.
I have a form where the user can upload a zip file, it works
I want to upload an image from disk, resize it, and then upload it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.