473,408 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

imagecreatefromjpeg, calling a .php file

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=".$t his->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?

Apr 16 '06 #1
5 3321
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=".$t his->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/functio...tefromjpeg.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
Apr 16 '06 #2
Hey thanks Erwin. I actually checked the box and that config option was
already enabled so all i had to do was give it a fully qualified url.

Apr 16 '06 #3

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=".$t his->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?


Why don't you just read from the database directly and use
imagecreatefromstring()?

Apr 16 '06 #4
Chung,

Im trying to break up as much as possible. This particular library I
really dont want to be dependant on any specific database
implementation. Im trying to abstract that out so i can reuse this
stuff independanly.

My DisplayImage.php script is dependant on the DB but not my
imagemanipulation script.

Good idea though, im wondering if instead of returning an image object
i could just return the string itself.

Apr 16 '06 #5

Areric wrote:
Chung,

Im trying to break up as much as possible. This particular library I
really dont want to be dependant on any specific database
implementation. Im trying to abstract that out so i can reuse this
stuff independanly.

My DisplayImage.php script is dependant on the DB but not my
imagemanipulation script.

Good idea though, im wondering if instead of returning an image object
i could just return the string itself.


In that case a slicker approach is to define a stream wrapper that
reads from the database. See
http://fi.php.net/stream-wrapper-register/.

Apr 16 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Justin Koivisto | last post by:
On my way out the door, but will need to know this in the AM. (and no, I didn't have time to RTMF...) Can I use raw data instead of a file patch with imagecreatefromjpeg? For instance, I used...
4
by: jn | last post by:
I'm working with images from a Kodak 2MP camera. It looks like the function will only create a resource if I give it horiznotal pictures from this camera....if I give it vertical (height larger...
4
by: Mike | last post by:
hopefully this is an easy one to solve and I'm just missing something little... basically, I had a nice little website running with php, apache, etc... that uses imagecreatefromjpeg to create...
2
by: jn | last post by:
This is the weirdest thing I've come across in a while. I'm trying to resize an image. If I give it a small image ( < 100K) it will resize. If I give it a larger image, it gives me the IE "Action...
1
by: Olivier | last post by:
Hi, I have the following code in my php script : $fhSrc = imagecreatefromjpeg($srcFile); This cause me the following error : Fatal error: Allowed memory size of 8388608 bytes exhausted (tried...
6
by: comp.lang.php | last post by:
PHP version 4.3.9 GD version 2.0.2 Whenever I use imagecreatefromjpeg(), PHP completely dies. No errors, no warnings, no notices, it dies in the following manner: If using Firefox it just...
4
by: jeffsnox | last post by:
Hi, I'm struggling to get imagecreatefromjpeg to work correctly. I'm running PHP 4.3.9 with GD bundled (2.0.28 compatible). If I run this: $myimage = imagecreatefromjpeg("myfilename");
1
by: tim.landgraf | last post by:
hi there, i am experiencing a strange problem. i am iterating through a given directory, selecting only jpg - images that are then resized and inserted into a database. everything works, but if...
2
by: Akshay Kumar Vishnoi | last post by:
when i am trying to create thumbnail from uploading image with calling a function containing imagecreatefromjpeg(), i found an error call to undefine function while the image is successfully loaded...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.