Jump to content

[SOLVED] Duplicate and rename image files?


iPixel

Recommended Posts

Here's what i want to do, let me know if it's duable and then i can start figuring out how with some help :).

 

I make a variable

$idphoto = $firstname . " " . $lastname . ".jpg";

 

I have images on the server (images/ID) that are generic ID photos

male1.jpg female1.jpg.

 

Since upon data insertion through SQL the $idphoto image file is not yet available since the picture ID had most likely not been taken i want to find male1.jpg/female1.jpg and make a copy of that image and rename it into $idphoto.

 

The progress would run something like this :

 

Submit form with info

get info

check if img file exists with $idphoto name

if it does not - make copy of generic image and rename to $idphoto

if exists just insert that img name into the database

then rest is downhill.

 

Thanks 2 all :)

Link to comment
https://forums.phpfreaks.com/topic/155241-solved-duplicate-and-rename-image-files/
Share on other sites

If you're just using it as a default image if someone does not upload or choose one, whay make copies of it at all? They can all just point to the same image.

 

Then all you need to do is check for the image, if there isn't one put the path to your default.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.