Question

Resize images

Asked by: xenoula

Hello everyone,

I would like some help about resizing images. I am developing an e-commerce site for selling cloths. I have create a control panel in order the administrator of the website to add new products, edit products and general to have control of his stock.
When the administrator adds a new product in the database he uploads also the images for the specific product.[In the site I am using two type of images for the products, the small one and a bigger one which I am using for different pages.] I have manage to write the code for uploading the images to the server using the following code:

PHP Code:
//Check for an product image
if (is_uploaded_file($_FILES['image_small']["tmp_name"]))
    {        
        if (move_uploaded_file($_FILES['image_small']["tmp_name"], "small_images/". $_FILES['image_small']["name"]))
                                {
                                    echo " The image for product has been uploaded! ";
                                   
                                   
                                }else {
                                            echo "The image for product could not be uploaded";
                                            $image='';
                                }
                        $image=$_FILES['image_small']["name"];
                        echo "image". $image;
                        } else {
                                 $image='';
                                 }


the form code
HTML Code:

<form action="" method="post" enctype="multipart/form-data" name="add"> <input name="MAX_FILE_SIZE" type="hidden" value="30000"> <input style="position:absolute; left: 158px; top: 508px;" name="image_small" type="file" >




What I would like help from you is how to resize the images that the administrator uploads to the server.
I would like when the user uploads the image to resize it into two type of dimensions.
The first to be the small image with dimension width:55pixels height:66pixels and the second, width:154, height:198.
I would like also when they are resized to be saved in different folder, for the small in the folder small and for the large images in the folder image.

I tryied to use the imagecopyresampled function but I did not manage to do it.
However, I would really appreciated if you could help me find how to do it.

Thank you very much,
Xenia
Edit/Delete Message

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2006-05-15 at 02:45:19ID21850402
Tags

php

,

resize

,

image

Topic

PHP Scripting Language

Participating Experts
4
Points
500
Comments
46

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. good stock images link
    I need some good links to stock images?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: xenoulaPosted on 2006-05-15 at 02:46:38ID: 16680893

sorry but i put it in a wrong cateogry , I wanted to put it  in php

 

by: nicholassolutionsPosted on 2006-05-15 at 05:16:41ID: 16681666

You may be interested in a short tutorial I wrote on this a while ago:  http://www.nicholassolutions.com/tutorials/php/index.php#cropresize

 

by: RQuadlingPosted on 2006-05-15 at 05:34:11ID: 16681772

If you have a significant number of images to resize, then external tools like Cerious Software ThumbsPlus may be of use. Nice app which can create all the mono thumbnails for you. Even contact sheets too if your images warrant that sort of thing.

 

by: RQuadlingPosted on 2006-05-15 at 05:34:31ID: 16681774

 

by: dutchclanPosted on 2006-05-15 at 06:00:46ID: 16681951

The logic is usually somthing like this.

1. Upload the image into the "tmp" directive.
2. Create a thump from that directive and either save it to file or database blob.
3. Create a (altered size) image from the original to fit into the site.

step three is to ensure that the image size doesnt "mess up" you template if any. So we parse the image twice. 1 to create a thump and 2 to create the image we like as result for some template.

lets say the max sizes of the thump will be 150x150 and the "larger" version should be somthing like 700x700max.

This is how we do it :D

// Function to calculate the image size //
function calc_dim($old_x, $old_y, $new_x, $new_y){
        if($old_x > $old_y){
            $t_new_x = $new_x;
            $t_new_y = $old_y * ($new_y / $old_x);
        }
        if($old_x < $old_y){
            $t_new_x = $old_x * ($new_x / $old_y);
            $t_new_y = $new_y;
        }
        if($old_x == $old_y){
            $t_new_x = $new_x;
            $t_new_y = $new_y;
        }
        $size = array ('width' => $t_new_x, 'height' => $t_new_y);
        return($size);  
    }

function create_image($source, $new_x, $new_y, $type, $location, $name){
         
        // Create a source pointer
            switch($type){
                case "image/jpeg" :
                    $pointer = ImageCreateFromJpeg($source);
                    $trigger = "1";
                    break;
                case "image/pjpeg" :
                    $pointer = ImageCreateFromJpeg($source);
                    $trigger = "1";
                    break;
                case "image/png" :
                    $pointer = ImageCreateFromPng($source);
                    $trigger = "1";
                    break;
                case "image/xpng" :
                    $pointer = ImageCreateFromPng($source);
                    $trigger = "1";
                    break;
                case "image/gif" :
                    $pointer = imagecreatefromgif($source);
                    $trigger = "2";
                    break;    
            }else{
                echo "type not allowed";
            }
         
        if($trigger = "1"){
            $old_x = imageSX($pointer);
            $old_y = imageSY($pointer);
         
            // Compute size //
            $size = $this->calc_dim($old_x, $old_y, $new_x, $new_y);
             
            if($thump_canvas = ImageCreateTrueColor($size['width'], $size['height'])){
                if(ImageCopyResampled($thump_canvas, $pointer, 0, 0, 0, 0, $size['width'], $size['height'], $old_x, $old_y)){
                    Imagejpeg($thump_canvas, $location.$name.'.jpg', 100);
                    Imagedestroy($thump_canvas);
                    return(true);
                }else{
                    return(false);
                }
            }else{
                return(false);
            }
        }else{    
            $old_x = imageSX($pointer);
            $old_y = imageSY($pointer);
            $size = compute_thump_size($old_x, $old_y, $new_x, $new_y);
         
            if($thump_canvas =imagecreatetruecolor($size['width'], $size['height'])){
                $clr['red']=255;
                  $clr['green']=255;
                  $clr['blue']=255;
                  if($pallet =imagecolorallocate($thump_canvas, $clr['red'],$clr['green'],$clr['blue'])){
                  imagefill($thump_canvas,0,0,$pallet);
                      if(ImageCopyResampled($thump_canvas, $pointer, 0, 0, 0, 0, $size['width'], $size['height'], $old_x, $old_y)){
                            Imagejpeg($thump_canvas, $location.$name.'.jpg', 100);
                            Imagedestroy($thump_canvas);
                            return(true);
                    }else{
                        return(false);
                    }
                  }else{
                      return(false);
                  }
            }else{
                return(false);
            }
        }    
    }

// You are using the upload directives so we dont actually need to "move" the file anymore and worry about rights etc, We just create 2 new ones like this //

if(is_uploaded_file($_FILES['tmp_name']) ){
       $path = './images/uploads/original/';
       $thpath= './images/uploads/thumps/';
      // Thump //
       $width = "150"; $height="150";
      create_image($_FILES['userfile']['tmp_name'], $width, $height, $_FILES[userfile]['type'], basename($_FILES['userfile']['name']), $thpath);
     //Image
         $width = "700"; $height="700";
      create_image($_FILES['userfile']['tmp_name'], $width, $height, $_FILES[userfile]['type'], basename($_FILES['userfile']['name']), $path);
}else{
    //no uploaded file
}

Good Luck!

 

by: xenoulaPosted on 2006-05-15 at 09:16:19ID: 16683598

Do I have to install the GD graphic library in order to manage do the resizing?

 

by: nicholassolutionsPosted on 2006-05-15 at 09:18:10ID: 16683614

yes...although if you use third party software as RQuadling suggested, perhaps not...

 

by: xenoulaPosted on 2006-05-16 at 05:57:47ID: 16690152

First of all thank you all for your response, however  I feel a little confused.

Can I adjust my code with a code that will resize and put in two diffeent folders the images?
Also how I can install the GD graphic?The php is not installed in my computer, as I connect with FTP with an exernal company that host
php and mysql.

 dutchclan  I used your code but it didn't run

So please more help?

Thank you,
Xenia
 

 

by: xenoulaPosted on 2006-05-16 at 08:03:04ID: 16691340

The GD library exists so I can use the GD library. However, the code of dutchclan is not working

 

by: xenoulaPosted on 2006-05-16 at 10:03:48ID: 16692534

I cannot do the resizing, so I would appreciate if somebody could help me adjusting the existing code I have written
to make also resize and store to two different folders.

Thank you in advance,
Xenia

 

by: xenoulaPosted on 2006-05-16 at 17:30:39ID: 16695509

Please any suggestions?

Thanks

 

by: dr_dedoPosted on 2006-05-16 at 18:08:48ID: 16695648

form page
<form enctype="multipart/form-data" action="upload.php" method="post">
<input type="file" name="uploadfile"/>
<input type="submit"/>
-------------------------------------------------------

upload.php page
--------------------
<?php
echo  $_POST['txt'];
$uploadedfile = $_FILES['uploadfile']['tmp_name'];
$src = imagecreatefromjpeg($uploadedfile);
list($width,$height)=getimagesize($uploadedfile);
$newwidth=600;
$newheight=($height/$width)*600;
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
$filename = "images/". $_FILES['uploadfile']['name'];
imagejpeg($tmp,$filename,100);

imagedestroy($src);
imagedestroy($tmp);
?>


this script requires a folder called images in the same location as the script and has to have write permission on it
this script will work on jpg files. it uses GD lib (ofcourse)

inform me of updates

 

by: xenoulaPosted on 2006-05-17 at 01:07:06ID: 16697121

Hi dr_debo ,

I tryied your code but is not working ,any suggestions?

Thanks,
Xenia

 

by: dr_dedoPosted on 2006-05-17 at 01:19:36ID: 16697188

Xenia

try to install php and mysql on your local computer for development, and after that upload your work to the production server. it is not recommended at all that you mess around with a production server!
my code works with me just fine, create a php file with phpinfo(); and in the resulted page search for GD part, after all, gd might not be installed in the first place. also, what is your PHP version ??

 

by: xenoulaPosted on 2006-05-17 at 01:25:50ID: 16697245

The version of php is PHP Version 4.3.10 and the informaiton for GD are the following:

GD Support       enabled
GD Version       bundled (2.0.28 compatible)
FreeType Support       enabled
FreeType Linkage       with freetype
GIF Read Support       enabled
GIF Create Support       enabled
JPG Support       enabled
PNG Support       enabled
WBMP Support       enabled
XBM Support       enabled

The inital code I wrote that uploads images in the server is working and is strange how the new code cannot work.It says that the image was uploaded but I cannot see teh image.

Thanks

 

by: dr_dedoPosted on 2006-05-17 at 01:57:49ID: 16697435

not working, like not seeing a result or spitting out errors ??
are u sure that the file upload folder has write permissions ??

 

by: xenoulaPosted on 2006-05-17 at 02:10:27ID: 16697497

It has the right permissions but still doesn't work.
When I upload the image doesn't give me any errors

 

by: dr_dedoPosted on 2006-05-17 at 02:38:43ID: 16697620

something is totally screwed here, this code is pretty simple, i tried it on my production server, which uses php.4.3
something is just wrong. maybe your ISP has uploads disabled or something, or you didn't set permission well !!!!

 

by: xenoulaPosted on 2006-05-17 at 02:47:28ID: 16697659

The strange thing is that when I used my code which is just upload images with the following code it did the upload:

//Check for an product image
if (is_uploaded_file($_FILES['image_small']["tmp_name"]))
      {            
        if (move_uploaded_file($_FILES['image_small']["tmp_name"], "../../images/small_images/". $_FILES['image_small']["name"]))
                                                {
                                                      echo " The image for product has been uploaded! ";
                                                      
                                                      
                                                      
                                                }else {
                                                                  echo "The image for product could not be uploaded";
                                                                  $image='';
                                                }
                                    $image=$_FILES['image_small']["name"];
                                    //echo "image: ". $image;
                                    
                                    
                                    } else {
                                                 $image='';
                                                 }

So I guest if the ISP has uploads displayed or I hadn't gave the correct permisions it shouldn't work neither my code,what you recommend?

Thanks

 

by: dr_dedoPosted on 2006-05-17 at 03:14:38ID: 16697765

u upload to this folder
"../../images/small_images"
did u adjust that folder in the code i sent u ??

ok, lets try my code with just the upload part, shall we ?
upload.php page
--------------------
<?php
echo (move_uploaded_file($_FILES['uploadfile']['tmp_name'],"images/". $_FILES['uploadfile']['name']))? "upload complete":"Upload failed";
?>

 

by: xenoulaPosted on 2006-05-17 at 03:31:18ID: 16697821

First of all thank you for your time that you help me, Ok it was uploaded to the server however it was not resized to smaller.

I put in the line of code:
$filename = "../images/small_images/". $_FILES['uploadfile']['name'];

instead of :

$filename = "images/". $_FILES['uploadfile']['name'];

<?php
echo  $_POST['txt'];
$uploadedfile = $_FILES['uploadfile']['tmp_name'];
$src = imagecreatefromjpeg($uploadedfile);
list($width,$height)=getimagesize($uploadedfile);
$newwidth=600;
$newheight=($height/$width)*600;
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
$filename = "../images/small_images/". $_FILES['uploadfile']['name'];
imagejpeg($tmp,$filename,100);

imagedestroy($src);
imagedestroy($tmp);
?>


Where do you think might be the problem

Thank you
Xenia

 

by: dr_dedoPosted on 2006-05-17 at 04:10:34ID: 16697973

please note that my code change file size to 600 X ???

upload a jpg file, that is, say 1200X1000 or something
or reduce 600 to a smaller value, say 250 and test the results

 

by: xenoulaPosted on 2006-05-17 at 04:10:49ID: 16697975

What I notice is that even though I have gave permision to the specific folder and its files
whenever I upload to the specific location it turns the specific image with no privileges

 

by: xenoulaPosted on 2006-05-17 at 04:40:26ID: 16698079

yes i change the dimension to 50

 

by: dr_dedoPosted on 2006-05-17 at 04:51:26ID: 16698129

<?php
echo  $_POST['txt'];
$uploadedfile = $_FILES['uploadfile']['tmp_name'];
$src = imagecreatefromjpeg($uploadedfile);
list($width,$height)=getimagesize($uploadedfile);

$newwidth=50;  //<------ here

$newheight=($height/$width)*50; //<----- and here

$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
$filename = "../images/small_images/". $_FILES['uploadfile']['name'];
imagejpeg($tmp,$filename,100);

imagedestroy($src);
imagedestroy($tmp);
?>

 

by: xenoulaPosted on 2006-05-17 at 05:20:20ID: 16698310

Ok, I just copy and paste what you write but again it doesn't resize it.

I have the following problems:
The first one is that when I succesfully upload an image to the server in the specific folder(which has full privileges)it changes the privilege
to 666 and cannot display the page when I go to the specific url in the browser.

However,when I am going to the server and change again the privileges of the image,it displays the normal size and not the smaller image.
when I go to the absolute url.



 

by: dr_dedoPosted on 2006-05-17 at 05:39:18ID: 16698437

try it on my own site
http://www.alatebaa.com/im/

the very very same script, on ur very own PHP version !!!

if it is not folder permission, then it is something magic or from March :)

 

by: xenoulaPosted on 2006-05-17 at 05:53:34ID: 16698549

Yes you are right I test in your site and is working.

Ok so the directory you are putting in the following code:

$filename = "../images/small_images/". $_FILES['uploadfile']['name'];

is which?

I think also that the problem is with the permissions,however the weard is that I change the privileges but somehow it changes again.

 

by: dr_dedoPosted on 2006-05-17 at 06:01:58ID: 16698631

i upload to a folder at the same level of my script
images/

try creating  a new folder

just a question, how do u change permissions of the folder ??

 

by: xenoulaPosted on 2006-05-17 at 06:08:37ID: 16698691

I tryied to change the path in order to store the image general in the website outside from the images folder and is working.
I have an Ftp software called Ipswitch WS_FTP professional and I change from this program.
I had change again with the same program the permission and it was ok.Is there any alterenative way to change them?

I would like to ask you a last question.I want to store in a differnet folder the large images with specific dimensions and in differnet folder
the small images with also specific dimensions.How I can do it regarding your code?

Thank you again,
Xenia

 

by: dr_dedoPosted on 2006-05-17 at 06:21:39ID: 16698827

just add this line before processing the image

$uploadedfile = $_FILES['uploadfile']['tmp_name'];
copy($_FILES['uploadfile']['tmp_name'],"images/large_". $_FILES['uploadfile']['name']);

here, the uploaded image will be saved as such with a prefix "large_"

 

by: xenoulaPosted on 2006-05-17 at 06:40:48ID: 16699025

It changes again the right , I can't understand why. I change also the previleges from Dreamweaver also but the same.
What else you think to try in order to change the permissions?

ALso regarding to the follwing code it doesn't resize it now,can you have it a look?

$uploadedfile = $_FILES['uploadfile']['tmp_name'];
copy($_FILES['uploadfile']['tmp_name'],"../large_". $_FILES['uploadfile']['name']);

echo  $_POST['txt'];
$uploadedfile = $_FILES['uploadfile']['tmp_name'];

//copy($_FILES['uploadfile']['tmp_name'],"../large_". $_FILES['uploadfile']['name']);

$src = imagecreatefromjpeg($uploadedfile);
list($width,$height)=getimagesize($uploadedfile);

echo (move_uploaded_file($_FILES['uploadfile']['tmp_name'],"../". $_FILES['uploadfile']['name']))? "upload complete":"Upload failed";

echo "file name ". $_FILES['uploadfile']['name'];

echo "filename ". $filename;


?>

<img src="../<? echo $_FILES['uploadfile']['name']; ?>">

Thanks

 

by: dr_dedoPosted on 2006-05-17 at 06:48:47ID: 16699117

for the permission, i connect to ftp via IE, and right click a folder -> properties and give write (or full control) to everyone. if u can't manage permisions, contact ur isp

what is that code ?? it is a bite of each post !!

use this
<?php
$uploadedfile = $_FILES['uploadfile']['tmp_name'];
copy($_FILES['uploadfile']['tmp_name'],"images/large_". $_FILES['uploadfile']['name']);
$src = imagecreatefromjpeg($uploadedfile);

list($width,$height)=getimagesize($uploadedfile);

$newwidth=100;
$newheight=($height/$width)*100;
$tmp=imagecreatetruecolor($newwidth,$newheight);

imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);

$filename = "images/". $_FILES['uploadfile']['name'];
imagejpeg($tmp,$filename,100);

imagedestroy($src);
imagedestroy($tmp);
?>
<img src="<?=$filename?>">

 

by: xenoulaPosted on 2006-05-17 at 07:40:56ID: 16699638

Now it is working great apart from the permission, some tims are ok some others are change,anyway I will put them just as it is in the directory.


Thank you very much for your help and your time,

Xenia

 

by: dr_dedoPosted on 2006-05-17 at 07:50:53ID: 16699726

welcome, glad it finally worked for u

 

by: xenoulaPosted on 2006-05-18 at 01:43:13ID: 16706770

hi dr_debo,

I have a problem with a problem with the images an dI would like to ask you something?
Some images does not upload them.

 

by: dr_dedoPosted on 2006-05-18 at 03:11:12ID: 16707117

try the simple code for testing uploads
<?php
echo (move_uploaded_file($_FILES['uploadfile']['tmp_name'],"images/". $_FILES['uploadfile']['name']))? "upload complete":"Upload failed";
?>

 

by: xenoulaPosted on 2006-05-18 at 07:31:47ID: 16709131

what I want to ask you is till how much has to be the size of the photo in order to resize it?

Because if I have dimention 400*400 or similar it displays only black image

 

by: dr_dedoPosted on 2006-05-18 at 09:15:46ID: 16710205

if it dislays balck, it means it is not a jpg file. if you have warnning on, you'd see a lot of warnning and division by zero errors and so

 

by: xenoulaPosted on 2006-05-18 at 11:20:07ID: 16711395

No nothing

 

by: xenoulaPosted on 2006-05-18 at 11:23:59ID: 16711436

Sorry, it displas that upload was failed.  the image is jpeg but the size is something like 1944x2592.
In the code that you wrote it has restriction about the size of the image?

 

by: dr_dedoPosted on 2006-05-18 at 11:26:50ID: 16711470

jpeg is not jpg !

 

by: dr_dedoPosted on 2006-05-18 at 11:27:35ID: 16711476

also check maximum file upload size in php.ini, the default is 2 MB

 

by: xenoulaPosted on 2006-05-18 at 11:33:34ID: 16711545

jpeg is as jpg ,i check it all in photoshop,all the other images where in jpeg and it upload them.
I didn't find the maximum upload size.

What else you suggest?

Thanks

 

by: xenoulaPosted on 2006-05-18 at 11:34:50ID: 16711563

100M is the upload_max_filesize

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...