2, December 2008

Photo Resize issue need help! - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: Photo Resize issue need help!
« previous next »
Pages: 1 [2] Print

Author Topic: Photo Resize issue need help!  (Read 2157 times)
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6479
39706 credits
Members referred : 374


It's time to use PHP5!


« Reply #20 on: Apr 04, 2007, 11:32:43 PM »

Try this :

ini_set('upload_tmp_dir''/tmp');

If you have access to the directory /home/finchers/public_html/dynamic/ make sure to CHMOD it before trying this (chmod 755 will work)

I'm trying to find the code that contains this line...

Which file and line number does it get placed or replaced in?

I'm assuming the upload_class.php, right??

you need to do that via the ftp client, which ftp client are you using?


Last blog : Just a better Internet portal provided by Google
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8266
42583 credits
Members referred : 3



« Reply #21 on: Apr 04, 2007, 11:35:54 PM »

Never mind the donations Smiley

First try to reach /home/finchers/public_html/dynamic/ with your ftp program/plesk or whatever control panel you have.

If you can chmod it to 777 then everything should work fine.

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Community Supporter ?
What a dork
*
Gender: Male
Posts: 16
100 credits
Members referred : 0


www.darrene.com - bloated flash site!


« Reply #22 on: Apr 05, 2007, 12:01:51 AM »

Try this :

ini_set('upload_tmp_dir''/tmp');

If you have access to the directory /home/finchers/public_html/dynamic/ make sure to CHMOD it before trying this (chmod 755 will work)

I'm trying to find the code that contains this line...

Which file and line number does it get placed or replaced in?

I'm assuming the upload_class.php, right??

you need to do that via the ftp client, which ftp client are you using?


I use dreamweaver to ftp upload. But I can change the file permissions by logging in to Vdeck (web admin).

Community Supporter ?
What a dork
*
Gender: Male
Posts: 16
100 credits
Members referred : 0


www.darrene.com - bloated flash site!


« Reply #23 on: Apr 05, 2007, 12:11:00 AM »

Ok, I CHMOD the directory that contains the upload_class.php file and now I am getting an image- it looks like the Thumbnail image and the file name given is 1175721359.jpg

Now, I'm getting this message-

Code:
Warning: chmod(): Inappropriate file type or format in /home/finchers/public_html/images/upload/upload_class.php on line 131

I'm one step closer to success!!!

Also, how can I modify the code where no matter what, it saves the file as " image1 " Huh

Community Supporter ?
What a dork
*
Gender: Male
Posts: 16
100 credits
Members referred : 0


www.darrene.com - bloated flash site!


« Reply #24 on: Apr 05, 2007, 12:21:13 AM »

Everything works now. The CHMOD of the folder is what was keeping me from successfully modifying the image and saving to the folder.

All I need is one last request and then you'll be done with me! (I *REALLY* appreciate all the help!!)

How can I make this where no matter what file gets uploaded, it gets named to " image1.jpg " and over-writes the previous version of image1.jpg?

I have the restrictions set to where you can ONLY upload a .jpg image- this setting is the ABSOLUTE last thing that needs to be done for what I need this script to do!

« Last Edit: Apr 05, 2007, 12:33:56 AM by Darren_E »
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8266
42583 credits
Members referred : 3



« Reply #25 on: Apr 05, 2007, 12:33:31 AM »

I guess you will have to rename the file in the upload process (Olaf will tell you how, I am not familiar with his class) and the delete the old file with the unlink function Visit through proxy

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6479
39706 credits
Members referred : 374


It's time to use PHP5!


« Reply #26 on: Apr 05, 2007, 12:49:02 AM »

I guess you will have to rename the file in the upload process (Olaf will tell you how, I am not familiar with his class) and the delete the old file with the unlink function Visit through proxy
everything is included in the class Cheesy

darren check this code to learn how to use the example:

   function process_image($landscape_only = false, $create_thumb = false, $delete_tmp_file = false, $compression = 85) {

in your case it should be true, true, true, 90

clear?



Last blog : Just a better Internet portal provided by Google
Community Supporter ?
What a dork
*
Gender: Male
Posts: 16
100 credits
Members referred : 0


www.darrene.com - bloated flash site!


« Reply #27 on: Apr 05, 2007, 01:14:25 AM »

[everything is included in the class Cheesy

darren check this code to learn how to use the example:

   function process_image($landscape_only = false, $create_thumb = false, $delete_tmp_file = false, $compression = 85) {

in your case it should be true, true, true, 90

clear?

Sort of clear (PHP is definitely NOT Flash ActionScript!!)

Landscape only = true (Yes, I do need it as a landscape only)
Thumbnail = FALSE (I don't need a thumbnail)
Delete tmp = true (no need for the tmp file)
Compression = 80 (80 works just fine for my application)

Here is how I am using your script-

1. User logs into his website to post a picture of a vehicle. This vehicle is the Special of the week.
2. Image gets resized to a specific 370 x 260 image size.

That part works- now all I need is THIS-

3. Image gets named as " image1.jpg " no matter what the file name was before since several people at this dealership will be uploading a photo for the "Special of the week."

4. Flash 9 document dynamically loads  image1.jpg from server and displays it on the website. This works but is set to load ONLY " image1.jpg " and nothing else.

That's why I need to rename the uploaded file to image1.jpg and overwrite the previous image.



« Last Edit: Apr 05, 2007, 01:17:40 AM by Darren_E »
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8266
42583 credits
Members referred : 3



« Reply #28 on: Apr 05, 2007, 01:38:52 AM »

I've noticed these two attributes in Olaf's class :

	
var 
$rename_file// if this var is true the file copy get a new name
	
var 
$file_copy// the new name


So if you change that to this :


	
var 
$rename_file true;
	
var 
$file_copy 'image1.jpg';


Is this working? If not post the code you are using.

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Community Supporter ?
What a dork
*
Gender: Male
Posts: 16
100 credits
Members referred : 0


www.darrene.com - bloated flash site!


« Reply #29 on: Apr 05, 2007, 01:54:33 AM »

I think this did it....(Still testing it...)

Once again, I can't thank you enough for the assistance.

Code:
function file_upload() {
$this->language = "en"; // choice of en, nl, es
$this->rename_file = true;
$this->ext_string = "";
}
function show_error_string() {
$msg_string = "";
foreach ($this->message as $value) {
$msg_string .= $value."<br />\n";
}
return $msg_string;
}
function set_file_name($new_name = "image1") { // this "conversion" is used for unique/new filenames
if ($this->rename_file) {
if ($this->the_file == "") return;
$name = ($new_name == "") ? strtotime("now") : $new_name;
sleep(3);
$name = $name.$this->get_extension($this->the_file);
} else {
$name = str_replace(" ", "_", $this->the_file); // space will result in problems on linux systems
}
return $name;
}
function upload($to_name = "image1") { // change back to "" if fail
$new_name = $this->set_file_name($to_name);
if ($this->check_file_name($new_name)) {
if ($this->validateExtension()) {
if (is_uploaded_file($this->the_temp_file)) {
$this->file_copy = $new_name;
if ($this->move_upload($this->the_temp_file, $this->file_copy)) {
$this->message[] = $this->error_text($this->http_error);
if ($this->rename_file) $this->message[] = $this->error_text(16);
return true;
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8266
42583 credits
Members referred : 3



« Reply #30 on: Apr 05, 2007, 01:56:33 AM »

No worries man. We started from zero knowledge too Wink

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6479
39706 credits
Members referred : 374


It's time to use PHP5!


« Reply #31 on: Apr 05, 2007, 08:38:47 AM »

Quote
Thumbnail = FALSE (I don't need a thumbnail)
Delete tmp = true (no need for the tmp file)

yes you're right the thumbnail is not needed (it was late during the last post)

but you have to delete the uploaded picture if the upload folder is not the same location then the folder for the photo.


Last blog : Just a better Internet portal provided by Google
Community Supporter ?
What a dork
*
Gender: Male
Posts: 16
100 credits
Members referred : 0


www.darrene.com - bloated flash site!


« Reply #32 on: Apr 05, 2007, 03:40:49 PM »

Hey Olaf, Nickolas,

I have EVERYTHING running just the way I need it to. Thank you, so much for all of your assistance.

I will keep monitoring this forum and offer what I have learned to others. Go ahead and lock this thread please!
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6479
39706 credits
Members referred : 374


It's time to use PHP5!


« Reply #33 on: Apr 05, 2007, 05:04:55 PM »

Hey Olaf, Nickolas,

I have EVERYTHING running just the way I need it to. Thank you, so much for all of your assistance.

I will keep monitoring this forum and offer what I have learned to others. Go ahead and lock this thread please!

you're welcome!


Last blog : Just a better Internet portal provided by Google
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=6348
Tags : gd resize image magik Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: 1 [2] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: Photo Resize issue need help!
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Dec 02, 2008, 08:17:32 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 37.937
Total Topics: 7.679
Total Members: 4.444
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: Naviator

21 Guests, 4 Users online :

11 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.