Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Dynamic Images with PHP
Old 07-02-2008, 09:32 PM Dynamic Images with PHP
MoForce's Avatar
Super Talker

Posts: 145
Name: Jack Shalt
Trades: 0
Ok so here's the problem... I've got it all setup like so...

PHP Code:
Header ("Content-type: image/png");
$img_handle imageCreateFromPNG("somewhereonawebsite");
$color ImageColorAllocate ($img_handle000);
ImageString ($img_handle53704,  "$test"$color);
ImageString ($img_handle537021,  "$blah"$color);
ImageString ($img_handle538342,  "$somethingelse"$color);
ImagePng ($img_handle);
ImageDestroy ($img_handle); 
there are no errors or anything (the code is not the problem)

What I'm trying to figure out is if I can have this image as a .png instead
http://website.com/image.php?id=1 (<--- example of non .png image- what I don't want)

Can I instead call it as a .png image
http://website.com/myimg.png (<--- example of what I want it to become)
so I can put it on forums? The "id" is important to gather the necessary info ($test, $blah, and $somethingelse). So it isn't like your typical dynamic image (like those that display ip)... at least I don't think so...

Last edited by MoForce; 07-02-2008 at 09:34 PM..
MoForce is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-03-2008, 12:51 AM Re: Dynamic Images with PHP
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
Using htaccess url rewriting (mod_rewrite) you can do this to rewrite the url string so that myimage1.png will become image.php?id=1

Code:
RewriteEngine On
RewriteRule ^myimage(\d+).png$ image\.php?id=$1 [L]
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 07-03-2008, 12:04 PM Re: Dynamic Images with PHP
MoForce's Avatar
Super Talker

Posts: 145
Name: Jack Shalt
Trades: 0
hmmm... yeah I figured it'd be something like that, but just one thing

I've got 100s of "id"s and well I don't want to create 100s of files for each individual. Is there any way around that?
MoForce is offline
Reply With Quote
View Public Profile
 
Old 07-03-2008, 01:35 PM Re: Dynamic Images with PHP
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Just target the same page every time:
PHP Code:
<?php
$number 
$_GET['id'];
?>
<img src="http://www.webmaster-talk.com/images/image<?=$number;?>.png">
Does this answer your question?
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is online now
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 07-04-2008, 12:27 PM Re: Dynamic Images with PHP
MoForce's Avatar
Super Talker

Posts: 145
Name: Jack Shalt
Trades: 0
I'd like to be able to have it like one of those things people have in their forum signatures...

like those from danasoft
http://www.danasoft.com/citysign.jpg
rather than
http://www.danasoft.com/something.php?id=12345 which don't show up on forums (it only shows up on webmaster-talk forums =P but nowhere else)

I wonder how they do it

Last edited by MoForce; 07-04-2008 at 12:29 PM..
MoForce is offline
Reply With Quote
View Public Profile
 
Old 07-04-2008, 01:13 PM Re: Dynamic Images with PHP
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Surely they use url rewrite too, and there is a script below the citysign.jpg that compare the ip address of the request to a location DB.
It's no big deal then to create the image and send it back.

I tend to believe that the .jpg is important to IE.
I know that IE don't follow the content-type header blindly.
If you create an image, and send just the header "output-type", you will be asked to save the picture.
But rename the script in .jpg, or use url rewrite, and IE will display it.
That little bugger...

So, yeah, map an precise url schema to your script, passing a parameter like MrGraphic and WayFarer explained you, and just make sure that you use a .jpg extension in the mapped url .
Then you should be good.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to Dynamic Images with PHP
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.44149 seconds with 12 queries