Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

When renaming images PHP does not recognize the file.

images php coding issues or problems here.

Moderators: macek, egami, gesf

When renaming images PHP does not recognize the file.

Postby imroue » Thu Nov 14, 2002 10:36 pm

When renaming images with a program that does them in batch process, PHP does not recognize the file.
I have tried "SmartReName" and other progs alike.

PHP has a hard time recongizing the extension.
$picsExtName = $picsPathParts["extension"]; //ex.= jpg

this Happens ONLY when all the pictures are renamed in a batch process.
Any ideas anyone?

:?
User avatar
imroue
New php-forum User
New php-forum User
 
Posts: 62
Joined: Fri Oct 11, 2002 6:53 am

Re: When renaming images PHP does not recognize the file.

Postby WiZARD » Tue Dec 17, 2002 6:27 am

Hi!
this is very simple example FROM PHP!!!
Code: Select all
function file_copy($file_origin, $destination_directory, $file_destination, $overwrite, $fatal) {

if ($fatal) {
$error_prefix = 'FATAL: File copy of \'' . $file_origin . '\' to \'' . $destination_directory . $file_destination . '\' failed.';
$fp = @fopen($file_origin, "r");
if (!$fp) {
echo $error_prefix . ' Originating file cannot be read or does not exist.';
exit();
}

$dir_check = @is_writeable($destination_directory);
if (!$dir_check) {
echo $error_prefix . ' Destination directory is not writeable or does not exist.';
exit();
}

$dest_file_exists = file_exists($destination_directory . $file_destination);

 if ($dest_file_exists) {
if ($overwrite) {
$fp = @is_writeable($destination_directory . $file_destination);
  if (!$fp) {
  echo  $error_prefix . ' Destination file is not writeable [OVERWRITE].';
  exit();
  }
  $copy_file = @copy($file_origin, $destination_directory . $file_destination);
  }           
} else {

$copy_file = @copy($file_origin, $destination_directory . $file_destination);
}
     } else {
     $copy_file = @copy($file_origin, $destination_directory . $file_destination);
  }
}

--------------
Example Usage:
$copy = file_copy("/path/to/original.file", "/path/to/", "destination.file", 1, 1);


In next time read carefuly http://www.php.net/manual/en/
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol


Return to PHP coding => Images

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.