Reply to Re: imagecreatefromjpeg, calling a .php file

Your name:

Reply:


Posted by Erwin Moller on 04/16/06 11:43

Areric wrote:

> Ok all. I have a series of images stored in a db. Im trying to work on
> a script that will let me scale them based on user input. Ive hit a bit
> of a roadblock on this line.
>
> $orig =
>
imagecreatefromjpeg("DisplayImage.php?imageId=".$this->mImage->GetImageId());
>
> Specifically it cant sopen that file.
>
> DisplayImage.php is pretty simple, it just displays an image from the
> db without writing to a file.
>
> Im thinking the problem is in how im pathing to DisplayImage.php.
>
> This file sits one level lower than most things so it should be
> ../displayImage, but i tried that and no luck.
>
> Any ideas whats wrong with that line?

There is nothing wrong with that line except that it is NOT the path to your
image.

You are confusing:
- the path to your image (nonexistent)
- with a php-script delivering the image.

Here is the difference: The is no such thing as the path to your image. Only
a URI (http) that points to your image.
The difference is that in the URI situation you invoke a script that
produces the image, while imagecreatefromjpeg WANTS A PATH, as can be read
in the documentation at www.php.net.
NOT a URI, unless:

from http://nl2.php.net/manual/en/function.imagecreatefromjpeg.php
--------------
Tip: You can use a URL as a filename with this function if the fopen
wrappers have been enabled. See fopen() for more details on how to specify
the filename and Appendix M for a list of supported URL protocols.
-----------------

So check that. :-)

And also remember that ../bla.php is NOT a good URI, it is just a part.
If you use URI, make sure they are full/well formed, like:
http://bla.bla.com/myImagescript.php?id=324

If you cannot make it work with fopenwrappers, just safe them from your
script in a directory, named after their ID's or something like that.

Regards,
Erwin Moler

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация