Jump to content

Archived

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

russia5

paths problem...

Recommended Posts

I have a path problem to my php file.  I am delivering images and data to my front end.  The data is transferred fine, but the images arn't. 

Initially, the images are uploaded to a folder called /upload/ The images are then resized by /make_thumbs.php (shown below) and transferred to /images_thumb1/ 

I am getting the famous x on the front end in place of the image, but the path to the image (by the right click of the mouse) is okay.  Hence, the coding deliers he path to where the image is suppose to be, just fine, but the image is not resized and/or transferred from /uploads/ to /images_thumb1/  ie) there is no image where there is suppose to be one. 

When the file below is on the first level it works fine.  The image is transferred fine and the path is fine.  But, when I move it to a 2 levels below, it does not.  The path is fine, but there is no image. 

I get this error message at the top of my admin:

[b]error upon resizing for thumbnail 1 : uploads/1154889068.jpg to images_thumb1/zzs-1-20060807.jpg[/b]

This is the file that is moved from /public_html/ to /public_hml/level1/level2/.  It is the admin that permits us to, "deliver the image and data to the front end"



                                        [b]Beginning[/b]
if ($res)
{
# resize and copy images
if (!empty($images))
for ($i = 0; $i < sizeof($images); $i++)
{

[b]To note: I have tryed changing the paths of uploads/.$oldImages[$i], image_original/.$images[$i], images_thumb1/ and images_thumb2/ and I got no results or bad results[/b]

$old = 'uploads/'.$oldImages[$i];
$new = 'images_original/'.$images[$i];
@copy($old, $new);

$thumb1 = 'images_thumb1/'.$images[$i];
$thumb2 = 'images_thumb2/'.$images[$i];
[b]//This is the next line in the folder two levels below: include('/home/russia5/public_html/make_thumbs.php');[/b]
[b]//Below is the include line in the top level where it works[/b]
include('make_thumbs.php');
@chmod($new, 0777);
@chmod($thumb1, 0777);
@chmod($thumb2, 0777); @unlink($old);
}

                                          [b]End[/b]

                            [b]Now, he /make_thumbs.php file is below:[/b]

<?php
$command = $imagemagik_path.'convert -resize ';

// resize for thumbnail 1 size
$current_command = $command.$thumb_size1.' "'.$old.'" '.$thumb1;
exec($current_command, $retarray, $retval);
// echo $current_command;
if ($retval != 0) // error
{
echo 'error upon resizing for thumbnail 1 : '.$old.' to '.$thumb1;
}

// resize for thumbnail 2 size
$current_command = $command.$thumb_size2.' "'.$old.'" '.$thumb2;
exec($current_command, $retarray, $retval);
// echo $current_command;
if ($retval != 0) // error
{
// echo 'error upon resizing for thumbnail 2';
}
?>

Share this post


Link to post
Share on other sites
Is the file being written to the folder? - permissions on the desination folder itself?

If the file is there, Can you get it by typing the url directly into your browser?

Share this post


Link to post
Share on other sites
Both files work when underneath public_html/  What happened, is that I transferred the top file (starting with Beginning) to two levels below public_html/  Hence, the chmd probably isn't the problem unless I am not seeing something.  (I am at a remote computer and cannot get to my FTP untill later to actually check)  I believe that maybe I have to do something with the first part of the below file, starting with declaring imagemak.  This is where the resizing is occurring and this is where the error is telling us that the problem is.  Maybe it is in the declaration of the variables. 

However, it kind of seems that the paths in the upper file would have to be changed.  But when I changed them, it did not work.   

Share this post


Link to post
Share on other sites
Thanks for the idea about the chmd, I checked it and the chmd is 777 and the image is not there.

After playing with it a lot, I come to think the problem is in the bottom set of coding.  ie)  make_thumbs.php  This line:

// resize for thumbnail 2 size
  $current_command = $command.$thumb_size2.' "'.$old.'" '.$thumb2

The reason is because the error that pops up in the admin is the line that is just below this

echo 'error upon resizing for thumbnail 1 : '.$old.' to '.$thumb1

or possibly the other line above it.

$command = $imagemagik_path.'convert -resize ';

Does anyone see what would cause the resizing error by just moving the paths of the admin containing the include?






Share this post


Link to post
Share on other sites

×

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.