Forum Moderators: coopster

Message Too Old, No Replies

Image in PHP

Find a class independant

         

pmdung

2:44 pm on Jun 22, 2004 (gmt 0)

10+ Year Member



I haven't used yet the librarys about image manipulation in PHP (for example, ImageMagic, GD lib,...) but I found that there is many hosts which do not support them. Therefore I would like a standalone PHP class for image processing. Anyone has somme hints?

henry0

7:23 pm on Jun 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Most will offer GD
you also may install image magic
[imagemagick.org...]

that link does not trigger an auto D-load but offers many tips and "How to"

<edit>Typo</edit>

pmdung

12:39 am on Jun 23, 2004 (gmt 0)

10+ Year Member



Yes, if you use GD, it must be installed on the server but it is not you who have this right! For ImageMagick, you haven't right to execute an application (function exec() is disabled). That is the reason why I need a PHP standalone class.
But thanks henry0, I will try convert code of ImageMagick to PHP if possible (very very complex and hard)!

ergophobe

4:13 pm on Jun 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




I will try convert code of ImageMagick to PHP if possible (very very complex and hard)!

Unless

1. You really want to do this in order to learn how (assuming it is even possible with PHP)

- OR -

2. Your time is of absolutely no value to you

Wouldn't it be easier to just switch to a host that allows you to make system calls to ImageMagick?

pmdung

1:28 am on Jun 24, 2004 (gmt 0)

10+ Year Member



Perhaps you have your reason! I must choice an approach most effective! But for only one operation (as resize image), I think the conversion is possible.

ergophobe

2:41 pm on Jun 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes, but it sounds like you are running in safe mode or some such thing. I suspect that this is not the last time that you will come up against an operation that will be unavailable to you. I would guess that for the same price or a little bit more you could get a host that will give you access to shell commands, the shell itself, let you install binaries and so on.

Tom

henry0

3:49 pm on Jun 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is still an almost “unprofessional” approach to your problem
If really resize is your object and if you do not have tons of pictures
Then you do not need GD or img magic to determine an image size
You can use the PHP getimagesize:
<<<
if ($s[picture]){
$size =getimagesize($s[picture]);
$width=$size[0];
$height=$size[1]
>>>
If an image is wider than allowed in your HTML
you can simply do an “img width” equal “whatever please you”....

It will take more loads on the server because you are still loading a full sized img and only temporally resizing it from an HTML side

<edit>
for a while I was not sure if getimagesize did not require GD; I confirm that it is a pure PHP function
check it out here
[us2.php.net...]
</edit>

pmdung

4:04 am on Jun 25, 2004 (gmt 0)

10+ Year Member



Thanks very much your ideas!
To ergophobe: Yes, I had developped something that I can't found on the internet. Just because I need and I like it.
To henry0: I know this function but for a gallery, the browser have to load 10-12 large images for preview only, it is not very good!
My purpose in this topic is a gallery, perhaps I choice a soft can make it and make a gallery before upload to host, it is lowest in price at this moment. Do you think so?