|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
I've tried to reproduce Ben Rowes Tutorial on resizing JPEGs, but get the following error message:
"Fatal error: Call to undefined function: imagecreatefromjpeg() ..." That relates to these snippets: $img_orig_size = getimagesize($_FILES['strFile']['tmp_name']); $img_orig_width = $img_orig_size[0]; $img_orig_height = $img_orig_size[1]; $img_original = ImageCreateFromJpeg($_FILES['strFile']['tmp_name']); $image_stored = time() . "_$name.jpg"; Could someone give me a helping hand? -- Martin Krumme |
|
#2
|
|||
|
|||
|
Is GD installed on your server? If not, you can download it from here.
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#3
|
|||
|
|||
|
Yes it is - and in the meantime I've found that the problem is only on my local platform (W2k - GD is installed). My provider runs Apache and after changing the chmod for the image directory everything goes as you wrote. Thank you very much.
If I don't mess you I have two more questions: a) Is there a solution for gif-images? b) How could I save the image-names in a mysql-database? Thanks again for the tutorial :-)) Martin |
|
#4
|
|||
|
|||
|
There is no solution for gifs that I know of because they are actually under some copy right law for the encyption or something, as for the file names, one of the variables in that code, contains the file names, all you need to do is run a database query to insert that variable into the database.
|
|
#5
|
|||
|
|||
|
Thanks again for the infos!
|
|
#6
|
|||
|
|||
|
Quote:
I've tried ... but up to now in vain - the database did not smile to me. $image_stored = time() . "_$name.jpg"; ImageJPEG($img_original, "$IMG_ROOT/$image_stored"); echo "Image Name: {$_FILES['strFile']['name']}<br> New Image Name: $image_stored<br> Width: $img_orig_width<br> Height: $img_orig_height<br> Max Image Size for Thumbnails: $IMG_WIDTH x $IMG_HEIGHT<br> <a target='_blank' href='$IMG_ROOT/$image_stored'>View Original Image</a><br><br>"; mysql_select_db("xyz"); $sql = "INSERT INTO filestore SET bildgr='$IMG_ROOT/$image_stored'"; mysql_select_db("xyz"); $sql = "INSERT INTO filestore SET bildgr='$IMG_ROOT/$image_stored'"; Where is my fault - if someone would be so kind to tell me. -- Martin |
|
#7
|
|||
|
|||
|
In the "heat of the night" I forgot that:
$action = mysql_query($sql); Everything works!! |
|
#8
|
|||
|
|||
|
ImageMagick
As a note, ImageMagick is another good alternative to, or along with GD. You just run the commands with shell commands for ImageMagick using:
PHP Code:
There site is http://www.imagemagick.com |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Programming Tools > Resizing JPEG |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|