Jump to content

Recommended Posts

PHP just sends the HTML to the browser, it doesn't interpret the HTML, so it doesn't load the image. That's the job of the browser. So the reason it's not working is because by the time the browser tries to load the image (the php script has already sent the output and stopped executing) the image was unlinked and does no exist anymore.

Link to comment
https://forums.phpfreaks.com/topic/182229-unlink-image/#findComment-961630
Share on other sites

PHP just sends the HTML to the browser, it doesn't interpret the HTML, so it doesn't load the image. That's the job of the browser. So the reason it's not working is because by the time the browser tries to load the image (the php script has already send the output and stopped executing) the image was unlinked and does no exist anymore.

 

Is there a way around this?

Link to comment
https://forums.phpfreaks.com/topic/182229-unlink-image/#findComment-961632
Share on other sites

To go along with what AlexWD said, one way to do it is create a script that spits out an image. the gist of it, readfile the image into a string, after that unlink the imagefile then use php to send the right headers and display the image to the browser.

 

So instead of

 

<img src="image.jpg" />

 

It would be

<img src="yourimagescript.php?name=imagename.jpg" />

 

If you need a better example let me know, I am bored enough to write some code.

Link to comment
https://forums.phpfreaks.com/topic/182229-unlink-image/#findComment-961638
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.