hi
everytime i try to upload image to create thumbnail i get error
Warning: imagecreatefromjpeg(gadmagento-error.jpg) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in E:\xampp\htdocs\thumb_script\thumb_script.php on line 5
Warning: imagesx() expects parameter 1 to be resource, boolean given in E:\xampp\htdocs\thumb_script\thumb_script.php on line 12
Warning: imagesy() expects parameter 1 to be resource, boolean given in E:\xampp\htdocs\thumb_script\thumb_script.php on line 13
Warning: Division by zero in E:\xampp\htdocs\thumb_script\thumb_script.php on line 16
Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in E:\xampp\htdocs\thumb_script\thumb_script.php on line 18
Warning: imagecopyresampled() expects parameter 1 to be resource, boolean given in E:\xampp\htdocs\thumb_script\thumb_script.php on line 20
Warning: mkdir() [function.mkdir]: Invalid argument in E:\xampp\htdocs\thumb_script\thumb_script.php on line 23
There was a problem. Please try again!
i have images folder and inside it i have thumbnail folder
only the original big images is getting upload in images folder.
Warning: imagecreatefromgif(images/16rows.gif) [function.imagecreatefromgif]: failed to open stream: No such file or directory in E:\xampp\htdocs\thumb_script\thumb_script2.php on line 12
Warning: imagesx() expects parameter 1 to be resource, boolean given in E:\xampp\htdocs\thumb_script\thumb_script2.php on line 16
Warning: imagesy() expects parameter 1 to be resource, boolean given in E:\xampp\htdocs\thumb_script\thumb_script2.php on line 17
Warning: Division by zero in E:\xampp\htdocs\thumb_script\thumb_script2.php on line 19
Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in E:\xampp\htdocs\thumb_script\thumb_script2.php on line 20
Warning: imagecopyresampled() expects parameter 1 to be resource, boolean given in E:\xampp\htdocs\thumb_script\thumb_script2.php on line 21
Warning: imagejpeg() expects parameter 1 to be resource, boolean given in E:\xampp\htdocs\thumb_script\thumb_script2.php on line 27
path still incorrect
E:/xampp/htdocs/images/16rows.gif
here is the error
Warning: imagecreatefromgif(E:/xampp/htdocs/images/16rows.gif) [function.imagecreatefromgif]: failed to open stream: No such file or directory in E:\xampp\htdocs\thumb_script\thumb_script2.php on line 13
Warning: imagesx() expects parameter 1 to be resource, boolean given in E:\xampp\htdocs\thumb_script\thumb_script2.php on line 17
Warning: imagesy() expects parameter 1 to be resource, boolean given in E:\xampp\htdocs\thumb_script\thumb_script2.php on line 18
Warning: Division by zero in E:\xampp\htdocs\thumb_script\thumb_script2.php on line 20
Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in E:\xampp\htdocs\thumb_script\thumb_script2.php on line 21
Warning: imagecopyresampled() expects parameter 1 to be resource, boolean given in E:\xampp\htdocs\thumb_script\thumb_script2.php on line 22
Warning: mkdir() [function.mkdir]: No such file or directory in E:\xampp\htdocs\thumb_script\thumb_script2.php on line 24
There was a problem. Please try again!
Not sure what you mean.
My code is to make the width be 200px but keeping the original aspect ratio.
Do you want which ever dimension is largest to be 200?
So portrait has height 200 and landscape has width 200?
$avatar_name is the location where the picture produced is placed (in this example it’s going to be used as an avatar). The 250 and the other 250 one is width, one is height, can’t remember off-hand which way round
Because 200x200 is a square, this will work as long as the uploaded images are also square.
If the uploaded images are not square the generated thumbnails will either be more or less distorted or be cropped.
Typically a more important consideration is maintaining the aspect ratio, not forcing a shape of a certain size. (avatars being an exception)
For example, To display side-by-side horizontal it might be important that they all have the same height. To display above-and-below vertical it might be important that they all have the same width.
Also keep in mind that if the uploaded image is a lot larger than the generated thumbnail there may be some loss of detail. Conversely, if much smaller there may be pixelation.
Your code in post #13 does not resize to a new file, it just displays the image at a reduced size.
If that is all you want to do, that could be done with new css properties.