Jump to content

Undefined variable in imagecreatefromjpeg()


bugzy

Recommended Posts

I was researching on how will I able to resize an image on image retrieve and I got this function

 

<?php

function me_resize_jpeg( $original_image, $new_height, $new_width, $filename )
{  
   // Resize the original image
   $image_resized = imagecreatetruecolor($new_width, $new_height);
   $image_tmp = imagecreatefromjpeg ($original_image);
   imagecopyresampled($image_resized, $image_tmp, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
   
   imagejpeg($image_resized, $filename.".jpg", 100);
   imagedestroy($image_resized);


}


?>

 

and I'm using it this way

 

<?php

$target_path = "../images_item/";

me_resize_jpeg($target_path.$edit_id.".jpg",'100','50',$target_path.$edit_id);

?>

 

 

 

But I'm getting this error:

 

Undefined variable: width in C:\wamp\www\runa\includes\functions.php on line 58

 

Undefined variable: height in C:\wamp\www\runa\includes\functions.php on line 58

 

 

The function is only asking for four parameters and I don't if the function is missing something...

 

Anyone?

Link to comment
Share on other sites

@bugzy, go to my web server and see how does my script work is.

I've used jQuery Image Cropping Plugin and php scripts to resize images.

If you like it I'll give you the scripts.

URL to server is:

http://kaneffbrookside.ca/stdimitar/login.php

user: jazzman

pass: password

Go to Crop New Image

jQuery Image Cropping Plugin - http://deepliquid.com/content/Jcrop.html

 

Link to comment
Share on other sites

Just a side question guys...

 

Does imagecreatefromjpeg()  actually resize the original image on the server side, or it's being resize only on the end-user?

imagecreatefromjpeg() doesn't do any resizing - it just converts a jpeg image to a GD image.

 

From the word converting, so the original image will be a GD file now literally? and imagecreatefromjpeg() doesn't do any and image duplication? like the duplicate one will going to be the GD file? and the original will still be there as is? 

 

Just want to be sure guys..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.