sufiansays
nice work
salamfallsays
How can I integrate this in a php MVC artchitecture /news/article/article_name
If you put the script in the root of your app (as per the instructions doc), you can resize any image within the root by adding query string parameters
eg path/to/image.jpg?width=100
If you want to have fully friendly urls for the resized images too, you could add a mod_rewrite rule so that you could refer to the image above as:
path/to/image.jpg/width/600/height/400
Does that answer your question?
dirty_densays
Doesnt seem to work for me
uploaded to windows server in a subfolder and get error ‘image cannot be found’ so I think ther may be a path script error for this server set up.
Also tried uploading on the same server to a site root as you suggest and still the same error using your sample files.
Can you suggest a code fix assume the error is caused around the define path lines in the php class?
We shouldnt need apache mod rewrite or the ht access for this to work, only for rewritten sef urls. Its doesnt say it is only for linux.
I prefered this script than the other similar one on here because of the cropping functionality.
Thanks
The script requires mod_rewrite only for friendly urls – mod_rewrite can be installed on windows/iis using a plugin such as Isapi Rewrite (www.isapirewrite.com).
The script can still be used without mod_rewrite, using query strings. Just put your source image in the source query string:
/path/to/resize.php?source=/path/to/image.jpg&width=100
I hope that helps – let me know either way.
dirty_densays
Yes I have this ISAPI rewrite filter already installed but dont require the urls changing. I already did exactly as you said. the image is visible and pointing to the correct path previously. But when I add the suffix eg
&width=100 I get the error. Ill try it on another server tomorrow, Maybe it is a server path issue.
adamhsays
The problem is that the path to your image is wrong. Can you send me the link you’re using to resize as well as a link to the original image so I can try to debug?
argosmediasays
What is the practical use of this script? It does not really resize pictures, it just visually resizes them. So big pics stay big, but they only appear smaller. This is effectively the same as good old height=”x” and width=”x” HTML parameters. I don’t understand the advantage of this script. Do I miss something?
It resizes images on the fly, so the image served to the browser is a smaller file size. If you use html width and height attributes, the full-sized file is served, resizing is done by the browser (badly and out of proportion) and your code won’t be valid xhtml.
The script can easily be updated to permanently save the resized images.
The script can also crop and stretch images as required.
argosmediasays
Oh I’m sorry, you’re right. I think I didn’t check well the first time…
dgoujardsays
Ok, i have buy this script but i need add in get quality=5 without quality i have error. And png without transparency !!! i have test with http://www.noelshack.com/up/aac/kevgil-angel-or-devil-tux-a77bc95f70.png and when i resize i have an black background… http://www.noelshack.com/up/aac/kevgil-angel-or-devil-tux_o-2a931f7f14.png
i have buy this script for transparency….
adamhsays
You can change the quality by adding quality=50 (or whatever). Default quality is 80.
I’ll have a look at the transparency issues and get back to you asap.
adamhsays
Glad to see people using the script – does anyone have any feature requests? Thinking about what to add to the next version.
ryan44says
I’m having a problem, the script resizes and crops great, but sometimes the images don’t load properly. i.e. if you refresh the page, some will display, refresh again, and none show.
Any ideas what’s causing this?
Hi Ryan
As ImageResize is server-side, the only thing I can think is that you (or your server) may be adding to or modifying the cache headers on the outputted image. Can you check to see if the problem affects the following image:
http://adamhopkinson.co.uk/classes/resize/images/spitfire.jpg?height=200
If not, please report back what browser you are using as well as what PHP version and GD version. You can get this by calling phpinfo().
Thanks, Adam
13comments