Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PHP_image_resample $newName question


Anguz

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?

Link to comment
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

Link to comment
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 :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...