You are not logged in.
Pages: 1
I'm trying to build a module that can process photos of various sizes and orientation. I wanted to use the crops in the Upload field options to make a few different sizes (thumb, mid, large), but I'm not seeing a way to deal with photos when the orientation is unknown (may be vertical or horizontal). I'm probably overlooking a simple solution, but any help is appreciated. Thanks.
Offline
If you're going to end up with two different crop sets (different dimensions for the portrait and landscape images) you'll need to put together a custom field type. The draw file can just include the default upload field type's draw file. In the process file you'd need to do a getimagesize call on the uploaded image to figure out what type it is and then swap in a different set of crops into $field["options"]["crops"] and then you could include upload.php's process file to handle the rest.
Offline
Also, I guess I don't really want to crop now that I think of it. I'm interested in resizing the images. If the width is greater than the height, then scale it to a certain width, retaining the aspect ratio, and for images that are taller than they are wide, scale based on height.
Offline
I'd proceed the same way with just swapping out $field["options"]["thumbs"] instead of crops
Offline
Thanks Tim. I'll see what I can do. Probably sounds more difficult than it actually is
Offline
Pages: 1