|
#1
|
|||
|
|||
|
php image
HI
I would help so that I can put link to one image in one php file and than set source, like <img src="image.php"> and image will show up. I was trying with simple echo but it doesn't work when I source it... |
|
#2
|
||||
|
||||
|
What code are you using to create the image?
You need to use PHP to create or output an image either by the inbuilt image functions or the header content type.
__________________
Cheers, Degs Please post back with your results CTH Terms of Use CTH Subscriptions :: Adaware Guide :: HijackThis |
|
#3
|
|||
|
|||
|
what I want to do is that somebody hosts image on some free hosting sites and then he can create short link for image, like http://www.cybertechhelp.com/images/...ation/boat.gif and he/she enters into form and get out short link for image, something like image.php?boat. And now for avatar we can set link to image or in html <img src="image.php?boat"> and we get boat.gif image
|
|
#4
|
||||
|
||||
|
There are different ways to do it.
Here is a basic example where you take the querystring variable name and add the file extension and echo the image http://domain.com/index.php?imagename PHP Code:
and here is an example to output a image using the header function e.g. Code:
<img src="http://domain.com/index.php?imagename" alt="myimage"> PHP Code:
__________________
Cheers, Degs Please post back with your results CTH Terms of Use CTH Subscriptions :: Adaware Guide :: HijackThis |
|
#5
|
|||
|
|||
|
the second option will work but is there anyway to also support other image formats? jpeg and png?
|
|
#6
|
||||
|
||||
|
You could reference the exension in the url rather than hardcode it.
The other way would be to use string functions to find a match for the filename and then use the mime_content_type function to get the file type. You could do this using a select case http://uk2.php.net/manual/en/functio...ntent-type.php
__________________
Cheers, Degs Please post back with your results CTH Terms of Use CTH Subscriptions :: Adaware Guide :: HijackThis |
|
#7
|
|||
|
|||
|
hm well if I'm running this on my home server it works with images located on pc. If I put it on server it says that can't show image because of mistakes.
http://url.si/test/image.php?http://...tons_cth/reply |
|
#8
|
||||
|
||||
|
You can't use readfile to open remote files. It for local files only. You may have luck with one of the other file opening fuctions such as fopen.
__________________
Cheers, Degs Please post back with your results CTH Terms of Use CTH Subscriptions :: Adaware Guide :: HijackThis |
|
#9
|
|||
|
|||
|
is it possible for little more help. With fopen I can't open even local files
|
|
#10
|
||||
|
||||
|
Here is an example for loading remote jpeg images
http://phparadise.de/php-code/image-...offsite-image/
__________________
Cheers, Degs Please post back with your results CTH Terms of Use CTH Subscriptions :: Adaware Guide :: HijackThis |
|
#11
|
|||
|
|||
|
can't make it to work...
|
|
#12
|
||||
|
||||
|
Maybe your PHP install does not have the required modules to do it.
__________________
Cheers, Degs Please post back with your results CTH Terms of Use CTH Subscriptions :: Adaware Guide :: HijackThis |
|
#13
|
||||
|
||||
|
Here is another example
Code:
http://domain.com/index.php?http://images.cybertechhelp.com/i/ban2.gif PHP Code:
__________________
Cheers, Degs Please post back with your results CTH Terms of Use CTH Subscriptions :: Adaware Guide :: HijackThis |
|
#14
|
||||
|
||||
|
Quote:
PHP Code:
__________________
Oracle's backup tutorial "A lot of people say games are addictive. Well, they're addictive in the sense that anything you like doing you repeat endlessly. But no one would say, 'Mr Kasparov, you have a chess problem,' or 'Tiger Woods, you have a golf addiction.'" - Ian Livingstone, Creative Director, Eidos. "A problem well stated is a problem half solved" - Charles Franklin Kettering Last edited by oracle128; August 22nd, 2006 at 05:04 PM. |
|
#15
|
||||
|
||||
|
for this simple script it doesn't really need it.
e.g. PHP Code:
PHP Code:
__________________
Cheers, Degs Please post back with your results CTH Terms of Use CTH Subscriptions :: Adaware Guide :: HijackThis |
![]() |
| Bookmarks |
«
Previous Topic
|
Next Topic
»
| Topic Tools | |
|
|
All times are GMT +1. The time now is 02:54 PM.
[
RSS ]








