Hi All
I have been trying to get around this problem but with no respite. One of the old programmers had written the code which identifies the image being loaded manupilates its name and saves it into a folder.
It does not work when I am trying and I have no idea as to what is happening the code looks ok. but does not give which folder to save in or I don't know if something needs to be added
I am posting the bit of code
PHP CODE
if (is_uploaded_file($property_image)) {
// there was a file uploaded with the product
$image_properties = getimagesize($property_image);
if ($image_properties) {
// the file was a valid image
$image_width = $image_properties[0];
$image_height = $image_properties[1];
$new_width = 175;
if ($image_width > $new_width) {
// the image is too big, so we must resize it
$ratio = $new_width / $image_width;
$new_height = $image_height*$ratio;
$image = ImageCreateFromJPEG($property_image);
$new_image = ImageCreateTrueColor($new_width, $new_height);
ImageCopyResized($new_image,$image,0,0,0,0,$new_width,$new_height,$image_width,$image_height);
ImageJPEG($image, $property_image);
}
$query = "SELECT MAX(id) AS id FROM houses";
$result = db_query($query, $db_connection);
$result = mysql_fetch_array($result);
$id = $result["id"];
$image_name = "/pictures/property_".$id;
if ($image_properties[2] == 1) $image_name .= ".gif";
elseif ($image_properties[2] == 2) $image_name .= ".jpg";
elseif ($image_properties[2] == 3) $image_name .= ".png";
copy($property_image, $image_name);
}
}
PHP CODE
Please help
Thank You
Image not being saved to folder
Moderator: General Moderators
-
Shendemiar
- Forum Contributor
- Posts: 404
- Joined: Thu Jan 08, 2004 8:28 am
-
Shendemiar
- Forum Contributor
- Posts: 404
- Joined: Thu Jan 08, 2004 8:28 am
I personally removed the feature to create directories from my php-made upload-manager and created ~450 directories by script on my computer and then uploaded them all via ftp. Voila, i had all the directories i needed and to these folders i could upload via php. I was in happy situation since i had static sturture that needs no deleting or creating folders.