Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving via imagejpeg

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
This simple resize script has been working for a long time.
The images are created on the fly and then passed back to a calling Perl script.
I need to save some images in another app. so I adapted this to save the image, substituted the red section for the green section.
No errors but the image is just not saving, can anyone suggest any reason for this?

Code:
<?php
	$img_name=$_GET['imnam'];
	$new_width=$_GET['maxwid'];
	$new_height=$_GET['maxhi'];

	$simg_name="../xxxxx/xxxxx/"."$img_name";
	$sav_name="[URL unfurl="true"]http://www.xxxxxxx.xxxxx/xxxxx/"."$img_name";[/URL]

	$size=GetImageSize($simg_name);
	$bwimage = ImageCreateFromJPEG($simg_name);
	$thumb = ImageCreateTrueColor($new_width,$new_height);

	ImageCopyResampled($thumb, $bwimage, 0,0,0,0,$new_width,$new_height,$size[0],$size[1]);

//	[red]imagejpeg($thumb) ;[/red]
	[green]imagejpeg($thumb, $sav_name, 100) ;[/green]


	ImageDestroy($bwimage);
?>

Keith
 
yup. unless you are using webdav it is unlikely that your web server will allow the saving of data. use a fileserver instead.
 
Could you elaborate on your reply please.
What is webdav?
How can I use a file server instead?
I had a similar app working on a shared hosting platform but this is on a VPS and refuses point blank to co-operate.

Keith
 
Look at sav_name. You are giving a web address (see the http prefix). When have you ever SAVED a file using a web address. It is possible but you would need to be using web distributed authoring and versioning (google for WebDAV). Most people save files by providing a file system address. Eg c:\my folders\my file.txt or ../myfolder/myfile.txt.

I suggest that this is why your code does not work.
 
Ah, got you, didn't understand the terminology.
The web address on save_name is a result of me trying more obscure methods to get the file to save.

The actual problem turns out to be two unrelated things, working together to cause confusion.
The main problem was the directory permissions were set wrong and then the Flash script was trying to display a resized image before it was created. I now create a resized image when the main picture is added to the stock list and that solved the problem.

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top