creating a box with an image - php

I'd like to take an image and turn the corners over to make a box (like a canvas painting)
i have gd library, imagemagick installed on the server and imagick php extension installed.
is it possible? any help appreciated

turn the corners over
You're gonna need to explain this a little better. You can overlay a frame onto an image with the GD functions. Check out imagecopymerge()

Related

Magento is Stripping all EXIF Data When Uploaded

Because this shop is an eCommerce it helps a lot to have picture with EXIF data, but for some reason when the images with EXIF data is uploaded magento seems to strip all of that info from the image and only show the bare image in the front end.!
can anyone tell me why this is happening and how we can avoid it?
Cheer!
It's a side effect of using the GD2 library for resizing.
lib/Varien/Image/Adapter/GD2.php
See if there's a module out there that uses ImageMagick if you want to preserve EXIF
Quote from PHP website on using GD:
When developing code to resize images, it is best not to use GD. When
using the current GD methodologies, you are reading content from an
image and manipulating it. By then writing that content to a brand
new file, you are losing the EXIF data.
For purposes when you want to retain EXIF data, it is recommended that
you compile in and use the PECL Imagemagick extension. It has great
resizing methods built right in and the EXIF data is retained.
ImageMagick isn't used because of issues with server loading.

Using imagegick with php to resize

I downloaded ImageMagick expecting to use it to resize images on my website like phpthumb use to do before the function are deprecated. But the fact is that i am not finding anywhere how to use it to resize en image with PHP code.
I see some command line but i want to resize using some php code
Thanks for helping
Sure you can resize images with imagemagik. PHP has a wrapper class. Check this https://github.com/avalanche123/Imagine and this http://imagine.readthedocs.org/en/latest/usage/introduction.html#resize-images. You can go with GD library if needs are minimal with images.

Where can I find comprehensive image manipulation library information?

I've spent a lot of time Googling and searching SO for information on image manipulation libraries with little success. Please direct me if this has been answered before and I just can't find it.
Basically I'm trying to resize an arbitrarily sized image to a couple of smaller thumbnail images, say 400px wide and 200px wide while maintaining the original aspect ratio. The original image is being uploaded via php (linux) and I've found that I can use Cairo, GD, GMagick, or ImageMagick but I've been unable to find comprehensive data on which is better suited for image manipulation. I have found comparisons for image creation, but that's functionality I won't be using.
I also have the option of uploading via php then performing the image manipulation via another method (perl/python/etc, for example) if that proves better suited.
Any pointers in the right direction are appreciated. Quality is my primary motivation followed by output image file size then library performance.
GD and ImageMagick are your best bets, so get some representative images and run some tests using:
imagecopyresampled() for GD
Imagick::thumbnailImage() for ImageMagick
Imagick::resizeImage() if you want more control and to try a few filter constants.
Resizing images in PHP with GD and Imagick has some code samples to get you going.
Compare them visually and by filesize. If there's no obvious winner, then run some benchmarks based on your expected needs. How to benchmark efficiency of PHP script is a good reference point.
Also take a look at:
Choosing between Imagemagick & GD for thumbnail creation
Should I use ImageMagick or GD2 with ImageAPI in Drupal?

resize animated GIFs with phpthumb

Im trying to use the phpThumb program to re-size an animated gif. But when i use it just as the site explains it in the demo, my re-sized GIF is single frame only.
Anyone have experience with this software that could offer tip?
The line im using is
phpthumb.php?src=/anitest/images/animation.gif&w=125&f=gif
Here is link of demo im using
Check if you have ImageMagick installed. If you don't then phpThumb will use GD library to resze your images and this library doesn't support animated gifs resizing. There is a nice script in phpThumb (in a phpThumb.config.php file) that allows you to analyse your server configuration and check if everything is set up correctly.
Here's the demo of the script: link

How would I go about cropping an image automatically on the server?

Like at Digg.com, I want to get members' pictures cropped for an avatar use. Please show me how to do this in PHP.
Here is a free script that does it using either GD or Imagick (Imagick is faster so I would use that):
Crop & Resize with JavaScript, PHP, and ImageMagick
From near the top of the page linked above:
Update: A new version of this example
and demonstration has been released.
Version 1.1 includes a GD version of
the script as well as a number of
functional improvements worth checking
out.

Categories