Jump to content
Sign in to follow this  
Anguz

PHP_image_resample $newName question

Recommended Posts

this code generates a name for the resampled picture based on the width and height of the pic:

 

// Name for the resampled image (always JPEG for decent results in size and quality

  $newName = eregi_replace( '.([a-z]{3,4})', "-{$width}x{$height}.jpg", $src );

 

my question is: wouldn't this two pictures with the same size generate the same value for $newName? if so, how could it be fixed?

Share this post


Link to post
Share on other sites

Only if you have two different pictures with the same name to start with. I don't see how that could be.

Share this post


Link to post
Share on other sites

What this function does is to generate a new file name from any existing file name with a 3 or 4 letter extension (the character matches any length of string). The new fie name is created by the replacement of the original extension by the size and the extension jpg

 

eg. if width=80 and height=100 and filename=myimage.jpg

 

resultant filename is: myimage-80x100.jpg

Share this post


Link to post
Share on other sites

aaah! I see!!

 

I thought it replace the whole name with the dimensions... forgive my ignorance hehe.. I still don't understand some code very well

 

thank you very much for your help :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×