28, May 2012

Photo Resize issue need help! - webmaster forum

 
Webdigity webmaster forums
[ 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
Instabuck - The easy way to sell digital products online

Author Topic: Photo Resize issue need help!  (Read 4103 times)
Community Supporter ?
What a dork
*
Gender: Male
Posts: 16
100 credits
Members referred : 0


www.darrene.com - bloated flash site!


« on: Apr 04, 2007, 07:54:15 pm »

Hi Olaf,

Do you have to use an application such as GD Library or ImageMajik to resize your photos?

I'm having trouble with this- I can upload a photo but I can't make it resize. If there is anywhere that has a tutorial for using these apps or a thread I might have overlooked- please help!

I'm trying to get any image uploaded to resize to 360 x 270 pixels in landscape format.

Thanks in advance!

Darren E
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Apr 04, 2007, 07:55:56 pm »

Quote
Do you have to use an application such as GD Library or ImageMajik to resize your photos?

yes one of them

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


www.darrene.com - bloated flash site!


« Reply #2 on: Apr 04, 2007, 07:56:57 pm »

Which one is easier? (I'm not an expert in PHP or coding)

Actually, I think GD Library is what I need to use for my server. Where can I find information on setting this up to work with Easy Upload??

I'm currently searching for this information but if you know of a good link that has documentation on setting this up for use with Easy Upload, PLEASE let me know!

« Last Edit: Apr 04, 2007, 08:05:48 pm by Darren_E »
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #3 on: Apr 04, 2007, 08:40:19 pm »

GD should be easier, but also have in mind that imagemajik is much better.

Anyway for GD you can use a class like this :

Code:
<?php
class image{
    var 
$image "";
    var 
$newimage "";
    var 
$image_quality 80;
    var 
$addborder 0;
    var 
$max_height 200;
    var 
$max_width 300;
    
    
// Main code
    
function resize(){
        
$src_img ImageCreateFromJpeg($this->image);
        
$orig_x ImageSX($src_img);
        
$orig_y ImageSY($src_img);
        
        
$new_y $this->max_height;
        
$new_x $orig_x/($orig_y/$this->max_height);  
        
        if (
$new_x $this->max_width) {
            
$new_x $this->max_width;
            
$new_y $orig_y/($orig_x/$this->max_width);
        }
        
        
$dst_img ImageCreateTrueColor($new_x,$new_y);
        
ImageCopyResampled($dst_img$src_img0000$new_x$new_y$orig_x$orig_y);
        
        if (
$this->addborder == 1) {
            
// Add border
            
$black ImageColorAllocate($dst_img000);
            
ImageSetThickness($dst_img1);
            
ImageLine($dst_img00$new_x0$black);
            
ImageLine($dst_img000$new_y$black);
            
ImageLine($dst_img$new_x-10$new_x-1$new_y$black);
            
ImageLine($dst_img0$new_y-1$new_x$new_y-1$black);
        }
            
        
ImageJpeg($dst_img$this->newimage$this->image_quality);
        
ImageDestroy($src_img);
        
ImageDestroy($dst_img);
    }
}
?>


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

Last blog : Butterfly Marketing 2.0
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #4 on: Apr 04, 2007, 09:07:54 pm »

Which one is easier? (I'm not an expert in PHP or coding)

Actually, I think GD Library is what I need to use for my server. Where can I find information on setting this up to work with Easy Upload??

I'm currently searching for this information but if you know of a good link that has documentation on setting this up for use with Easy Upload, PLEASE let me know!



do you tried the photo upload extension? there is a resize function included

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


www.darrene.com - bloated flash site!


« Reply #5 on: Apr 04, 2007, 09:09:05 pm »

I'm going to try that right now...

If this works, where do I donate!!!!!!
Community Supporter ?
What a dork
*
Gender: Male
Posts: 16
100 credits
Members referred : 0


www.darrene.com - bloated flash site!


« Reply #6 on: Apr 04, 2007, 09:16:35 pm »

Ok something is NOT getting processed...And it's not giving me any error codes.

I'm not 100% sure about this line-

Code:
<form action="<?php echo $_SERVER['/PHP_SELF']; ?>" method="post" enctype="multipart/form-data">

This might be where the error is coming from. (Still testing)
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #7 on: Apr 04, 2007, 09:20:51 pm »

replace

$_SERVER['/PHP_SELF'];?>

to this :

$_SERVER['PHP_SELF'];?>

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

Last blog : Butterfly Marketing 2.0
Community Supporter ?
What a dork
*
Gender: Male
Posts: 16
100 credits
Members referred : 0


www.darrene.com - bloated flash site!


« Reply #8 on: Apr 04, 2007, 09:26:37 pm »

GREAT!! Ok ok....last question,

I'm using foto_upload.php and of course the upload_class.php files to get this going...
How can I make this write and over-write using the name "image1" ??

In other words, I want whatever image that gets uploaded to be renamed to "image1" and resized to 370 x 260.
(I'm currently getting CHMOD errors but that's not a big deal, I can fix that....)
« Last Edit: Apr 04, 2007, 09:31:14 pm by Darren_E »
Community Supporter ?
What a dork
*
Gender: Male
Posts: 16
100 credits
Members referred : 0


www.darrene.com - bloated flash site!


« Reply #9 on: Apr 04, 2007, 09:42:50 pm »

Code:
Warning: move_uploaded_file(/home/finchers/public_html/dynamic/1175716232.jpg): failed to open stream: Permission denied in /home/finchers/public_html/admin/upload_class.php on line 130

Warning: move_uploaded_file(): Unable to move '/var/tmp/php82jAgY' to '/home/finchers/public_html/dynamic/1175716232.jpg' in /home/finchers/public_html/admin/upload_class.php on line 130

Warning: getimagesize(/home/finchers/public_html/dynamic/1175716232.jpg): failed to open stream: No such file or directory in /home/finchers/public_html/admin/foto_upload.php on line 54

Warning: copy(/home/finchers/public_html/dynamic/1175716232.jpg): failed to open stream: No such file or directory in /home/finchers/public_html/admin/foto_upload.php on line 42

Warning: copy(/home/finchers/public_html/dynamic/1175716232.jpg): failed to open stream: No such file or directory in /home/finchers/public_html/admin/foto_upload.php on line 48


Frustration...you just have to love it! This is killing me.
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #10 on: Apr 04, 2007, 09:46:52 pm »

This is not a problem of the script, but of the php configuration. Contact your host and send them the first line of the error

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

Last blog : Butterfly Marketing 2.0
Community Supporter ?
What a dork
*
Gender: Male
Posts: 16
100 credits
Members referred : 0


www.darrene.com - bloated flash site!


« Reply #11 on: Apr 04, 2007, 09:57:53 pm »

This is not a problem of the script, but of the php configuration. Contact your host and send them the first line of the error

Ok...So I'm assuming the GD Library isn't on the server? (I'm using Ipower.com for my hosting). Tech support said GD Library is installed. But then again, I'm not 100% confident in THEIR tech support.

(talking to them now)
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #12 on: Apr 04, 2007, 10:03:38 pm »

No this is not about GD. It looks like a permission problem. For some reason apache is not capable of read/write in the tmp folder.

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

Last blog : Butterfly Marketing 2.0
Community Supporter ?
What a dork
*
Gender: Male
Posts: 16
100 credits
Members referred : 0


www.darrene.com - bloated flash site!


« Reply #13 on: Apr 04, 2007, 10:05:48 pm »

Is there something that can be done to fix this???

Thank you SO much for your help BTW....
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #14 on: Apr 04, 2007, 10:18:18 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)

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

Last blog : Butterfly Marketing 2.0
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #15 on: Apr 04, 2007, 10:21:58 pm »

I remember me that there are some really bad configured servers.

try also a chmod value of 0777 you can change this value in the upload class file (if needed)

but I think your upload directories should be enough

Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #16 on: Apr 04, 2007, 10:23:07 pm »

And Darren thanks for the donation (I thinkI  should give some bucks to you Nick because of all your help Wink)

I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #17 on: Apr 04, 2007, 10:25:12 pm »

I thinkI  should give some bucks to you Nick because of all your help Wink

No that's not necessary. You already done enough for me Smiley

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

Last blog : Butterfly Marketing 2.0
Community Supporter ?
What a dork
*
Gender: Male
Posts: 16
100 credits
Members referred : 0


www.darrene.com - bloated flash site!


« Reply #18 on: Apr 04, 2007, 10:30:36 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??
Community Supporter ?
What a dork
*
Gender: Male
Posts: 16
100 credits
Members referred : 0


www.darrene.com - bloated flash site!


« Reply #19 on: Apr 04, 2007, 10:31:42 pm »

And Darren thanks for the donation (I thinkI  should give some bucks to you Nick because of all your help Wink)

NOO!!! I was planning on donating to him also!! (This is VERY important to me right now....)
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....

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?
May 28, 2012, 08:25:55 pm





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!






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