On 9/4/07, Anna P <[EMAIL PROTECTED]> wrote:
>
> Hi. I have problem with web photo gallery for a store.
> Photos are uploaded by CMS. They are stored in webroot/img/upload and
> their name is like "photo_file1_{item_id}", "photo_file2_{item_id}",
> etc.
>
> The problem is when I try to display photos and first I want to check
> if the item of the store has a photo.
>
> <?php if(is_file($this->webroot."img/upload/photo_file1_".$item['Item']
> ['id'].".jpg")):?>
> <img src="<?php echo $this->webroot?>img/upload/photo_file1_<?php echo
> $item['Item']['id']?>.jpg" />
> <?php endif;?>
>
> It shows me nothing, but the file exists. In fact, when I remove "IF"
> it shows me photo.
> Anyone maybe knows how to deal with this?

Well, given that is_file() is a PHP function, not a Cake-specific
function, my first guess would be that the path to the file you are
giving to is_file is incorrect.  Remember, there is a difference
between file paths and locations via URL.

The fact that it shows up when you get rid of the if means that you
are correctly passing in a location that the web browser can use to
find the file.  In all seriousness, try printing out what you are
passing to is_file and try typing (if you are using UNIX) 'ls
FullPathToFileYouAreUsing'.  If you don't find the file there, then I
think you've found the problem.

Hope that helps.

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to