Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manipulating big images in PHP

Status
Not open for further replies.

petersJazz

Programmer
Jan 28, 2002
222
EU
hi,

Refer to thread434-1411764 :

Is there a way to open part of an image? Like
Code:
imageCreateFromJpeg(fileneme,x,y,w,h)
 
You may be able to crop it (though I think not in the way you've stated above) but you will still need to read the entire image into memory in order to do that.



--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
You would need to use imagecopyresized() to crop the image, but as I said above you will need to read the image into memory first.

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
the answer to your original question is 'No'. as foamcow intimated.

surely it is of assistance to be given the answer to the question that you asked?

if you're asking the question: how do i skin this particular cat given my particular constraints? then the answer would be to increase the amount of memory available to your script. you can do this by adding this code at the start of your script

Code:
ini_set ('memory_limit', '128M'); // to set to 128 MB
 
hi,

its not possible to increase memory on the web hotel im using.
 
From reading the other post I have a feeling that there is something wrong with your hosting environment.

I think you said the image was 2Mb, even when that is decompressed I doubt it's going to be too large. But that depends on the operations you are carrying out and how you are scripting them.

There could be some kind of memory leak going on or your script is not destroying properly so you just keep eating up the available memory.

Have you tried setting the memory limit as jpadie has suggested? Whenever I've tried this, it has worked. One site I have built using [url ]ResourceSpace[/url] needed me to bump the memory limit up to 400Mb. But this was dealing with some very large, hi-res images for use in print.

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
memory limits can be changed programmatically as i posted.
 
...assuming that you are using a recent (5.2.1 +) version of php. if you have a lower version then you can set memory limit only if the relevant option was specified at compile time.

for many hosts that use cgi you can upload a php.ini file to the directory in which the script is found.
 
hi,

thank you for your help but its almost the same discussion as the threed I refered to. I can not change memory, this is limited according to the support at the web hotel (its not version 5 yet). And its not a memory leak, I have put in a lot of echo to verify existing memory. So my orginal idee is still to open the big image in slices. Or as the users needs to do now, resize the image before upload to site.
 
then the answer is still 'no'.

you are left with a simple choice of living with the issue or moving hosts.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top