View Full Version : PHP jpg
lord22
11-15-2009, 09:43 PM
Hi
How can I upload a JPG image and convertit into jpg (lower-case)?
Thanks
djr33
11-15-2009, 10:22 PM
Upload it like normal, and just change the name when you are saving it to the server. This is very simple, and if you are only doing a certain name then it is just changing "JPG" to "jpg"... that's all.
If you need more help, you will need to post more information.
Please use a more descriptive title than "Help", etc. It will let us know what we are looking at, and make it easier to find the thread if we need to come back to help later.
bluewalrus
11-16-2009, 12:15 AM
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
<input name="uploaded" type="file" />
<input type="hidden" name="sent" value="submitted" />
<input type="submit" value="Upload File" />
</form>
<?php
if (isset($_POST['sent'])) {
$file_name = basename($_FILES['uploaded']['name']);
$ext = substr($file_name,strlen($file_name)-3,3);
$lowercase_it = explode($ext, $file_name);
$file_name = $lowercase_it[0] . "jpg";
$dir = "images/";
$put_it_up = $dir . $file_name;
if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $put_it_up)) {
echo "Uploaded";
}
else
{
echo "Error ".$_FILES['uploaded']['error'];
}
}
?>
james438
11-16-2009, 03:22 AM
$text="sampleimage.JPG";
$text=str_replace("JPG","jpg",$text);or
<?php
$text="http://www.animeviews.com/images/armitage.JPG";
$text=explode('.',$text);
$num=count($text);
$num=$num-1;
$text[$num]=strtolower($text[$num]);
$text=implode('.',$text);
echo "$text";
?>
lord22
11-16-2009, 05:58 AM
Hi, sorry for the title, it was a mistake- I changed it.
Thank you very much!
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.