...

View Full Version : Resolved Skip if exist



cat250
01-15-2012, 03:08 PM
Hello again.

I have this:

file_put_contents("".$function['Title'].".png",file_get_contents("".$function['Poster'].""));

What code do:
copy image from website.com/a.png to a.png and website.com/b.png to a.png.

After this I have:


echo "<img src=".$function['Title'].".png' />";

Return:
<img src="a.png" />
<img src="b.png" />

This is perfect, but I want to skip first code (file_put_contents) if images (a.png and b.png -> "".$function['Title'].".png") already exists. Hope u understand. Sorry for bad english.

Thanks! :thumbsup:

BluePanther
01-15-2012, 03:35 PM
This post is just to clarify what I think you mean. You want to check if $function['title'].png is already in $function['roster'] before you use file_put_contents?

cat250
01-15-2012, 03:44 PM
This post is just to clarify what I think you mean. You want to check if $function['title'].png is already in $function['roster'] before you use file_put_contents?

Hmm, yes, this is what I need.
First to check if "".$function['Title'].".png" exist, if exist to execute echo "<img src=".$function['Title'].".png' />";, else execute file_put_contents and then echo... Thank u.

BluePanther
01-15-2012, 03:54 PM
Hmm, yes, this is what I need.
First to check if "".$function['Title'].".png" exist, if exist to execute echo "<img src=".$function['Title'].".png' />";, else execute file_put_contents and then echo... Thank u.

To check if it exists in file_get_contents($function['radio'])?

cat250
01-15-2012, 03:56 PM
To check if it exists in file_get_contents($function['radio'])?

What "radio"? :)
Nop, to check if exists in folder. $function['Poster'] exists and it's picture, sure!

BluePanther
01-15-2012, 03:58 PM
What "radio"? :)
Nop, to check if exists in folder. $function['Poster'] exists and it's picture, sure!

Sorry, I meant to say 'Poster' :). So you want to check if it exists in file_get_contents($function['Poster'])?

cat250
01-15-2012, 04:01 PM
Sorry, I meant to say 'Poster' :). So you want to check if it exists in file_get_contents($function['Poster'])?

Nop, want to check if "".$function['Title'].".png" exists in folder.

12k
01-15-2012, 05:36 PM
use file_exists($filePath);

cat250
01-15-2012, 06:55 PM
use file_exists($filePath);

Fixed, thank u. :thumbsup:

If u can, take a look here, please: http://www.codingforums.com/showthread.php?t=248918
Thanks again!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum