Jump to content

Linking to an image from a subfolder


djfox

Recommended Posts

php is being used but because the problem is that the site, for whatever reason, can`t find the image, it seems to be more of an html problem.

 

<?php
if(!$offset) $offset=0;
  $recent = 0;
  $res = mysql_query("SELECT id, image, folder FROM folder_inven WHERE folder='1' ORDER BY id DESC")or die( mysql_error() );
  while( $fold = mysql_fetch_row($res) ){
if( $recent >= $offset && $recent < ($offset + 24 )){
    
    if( $recent%4 == 0 ){
echo "<tr><td><tr><td><tr><td><tr><td><tr>";
    }
    $res2 = mysql_query("SELECT id, name, url, addDate FROM image WHERE id='$fold[1]' ORDER BY name ASC");
$image = mysql_fetch_row($res2);
mysql_free_result($res2);

$im = "http://secrettrance.net/$image[2]";

list($width, $height, $type, $attr, $size) = getimagesize("$im");
$size = getimagesize($im);
$blah = getimagesize("$im");
$filetype = $blah['mime'];

if ($filetype == 'image/jpeg') {
echo "<td width=25%><center><a href='trances.php?id=$image[0]' title='$image[1] on $image[3]' target='_blank'><img src='thumbnail.php?img=$im' border=0></a>";
}
elseif ($filetype == 'image/png') {
echo "<td width=25%><center><a href='trances.php?id=$image[0]' title='$image[1] on $image[3]' target='_blank'><img src='thumbnail2.php?img=$im' border=0></a>";
}
elseif ($filetype == 'image/gif') {
echo "<td width=25%><center><a href='trances.php?id=$image[0]' title='$image[1] on $image[3]' target='_blank'><img src='thumbnail3.php?img=$im' border=0></a>";
} 	
  }
$recent = $recent + 1;
}
?>

 

Here`s the error messages (condensed):

Warning: getimagesize(http://secrettrance.net/gallery/Beloved Doll/00395.jpg) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/secrett1/public_html/enomayrevelation/art.php on line 32

 

Warning: getimagesize(http://secrettrance.net/gallery/Beloved Doll/00395.jpg) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/secrett1/public_html/enomayrevelation/art.php on line 33

 

Warning: getimagesize(http://secrettrance.net/gallery/Beloved Doll/00395.jpg) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/secrett1/public_html/enomayrevelation/art.php on line 34

 

For proof that the image does exist in that location:

http://secrettrance.net/trances.php?id=1682

Link to comment
Share on other sites

I`ve tried calling on the image with regular html:

<img src="http://secrettrance.net/gallery/Beloved Doll/00395.jpg">

 

And it doesn`t appear at all.

 

I have also tried:

<img src="http://secrettrance.net/gallery/Beloved%20Doll/00395.jpg">

Link to comment
Share on other sites

This will work:

 

<img src="http://secrettrance.net/gallery/Beloved%20Doll/00395.jpg">

 

As I checked, and the image existed. but you should really get in the habit of not using spaces or capital letters in file names. They just cause errors like the one you are having. So you need to first go into your server, and change the file named 'Beloved Doll' to 'beloved_doll'.

 

You will then need to change the URL that you have saved in your database from

 

Beloved Doll/00395.jpg'

 

to

 

beloved_doll/00395.jpg'

 

This should solve your problems (or at least the initial ones. I think I see some potential problems later in your code)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.