I’m experiencing strange issues with the image upload function in the webtop:
Although I upload three different images as source image, standard image and thumbnail, FarCry does not honor their sizes but alters them, using the source image as master. Both the source image and the standard image have a size of 1200 x 600 pixels, the thumbnail image 680 x 600 pixels. The current webtop behavior means that an image that’s supposed to be 1200 x 600 pixels measures only 700 x 350 pixel (as looked up in the standard image folder).
Also, after saving the image content object, there are six images in the respective directories: two each in the source, the standard, and the thumbnail directory.
Any pointers where to look what’s happening behind the scenes will be appreciated.
Which upload feature are you using exactly? Can you screenshot the upload form element to put it in context for us?
If you upload the source its probably designed to cut/crop for the standard and thumb by default. You would have to make sure that your Source upload has completed, before uploading the others; perhaps, save and re-edit the image to be sure.
@ Justin: I checked the p720 branch but could not find anything related that’s newer than the 7.29 release.
@ modius: I use the default dmImage webtop form for the upload (no bulk, nothing special).
To reproduce the issue, I did the following:
removed all files with the webtop in the SourceImage, StandardImage, and ThumbnailImage directories,
cleaned up the directories by hand,
stopped the CF server (I’m running CF 11 v12 on Mac OS X El Capitan 10.11.6 with Apache),
cleared the FarCry cache directory,
restarted FarCry,
Content > Media & Categories > Image Library,
clicked on “Add+,”
filled in the fields (I added an additional text field named “copyright” which will be displayed before the “alt” textfield – see below --),
uploaded the three images and hit “Save.”
When revising the data with the object dump, it immediately became clear that FarCry had replaced my images because they are shown in the fields with an added “1” before the file extension.
Looking up the image directories content, I realized that FarCry had uploaded two images each: the original ones and those with the “1” at the end. And it obviously had altered all of them (except the source images, I suppose).
The extension I have done to the dmImage content type looks like below. I copied the CFC header, replaced the extension with the base type path, added the new property and updated the COAPI. (As I did back with FC 4.x.) The extended CFC looks like the following:
The head of the p720 branch is the latest maintenance fixes for the yet
unreleased 7.2.10, so if you clone the repo from GitHub and checkout the
p720 branch you’ll see the version in the webtop footer shows 7.2.10.
I’m 95% sure there was a fix for these issues within the last few months, I
just haven’t done the 7.2.10 release yet.
I’ll take a look at the file duplication issue next week. Last time I fixed it, it was related to a validation bug.
In regards to the image sizes for Standard and Thumbnail, if you don’t upload an image that has matching dimensions then they will be resized.
This seems like the expected behaviour to me. The Standard image property in Core’s dmImage.cfc has a width of 700 set but no height, which means if you upload any image that is larger or smaller than 700 pixels wide then it will be resized (scaled, maintaining aspect ratio). The Thumbnail image property has a width and height of 80 pixels, which means that it will always resize (cropped to the centre of the image) to ensure the thumbnail has exactly those dimensions (unless you upload an image that is already 80x80, in which case it won’t process it). You can see the properties defined here:
If you want different dimensions for your application, you can override the properties by extending dmImage.cfc in your project and set the ftImageWidth and ftImageHeight attributes appropriately.
Why does the FarCry core try to determine which size the uploaded files shall have at all? And: The required sizes might be different, depending on the purpose the image shall serve on the site…
Anyway: Do I understand correctly that if I don’t specify the ftImageWidth and ftImageHeight at all, I will be able to upload the images in exactly the size I prepared them? (Or will the values in the core handler override my “non-settings”?)
The standard and thumbnail properties are there as helpers, because you almost never use a source image directly on the front end of a site/application especially not a huge 4500x2500 pixel source image.
The standard image is just a reasonable sized image that could be used for body content (hence the 700 pixels of width), and it’s up to the developer to customise it if you’d prefer something different.
The thumbnail image is intended to be a small representation that can be used in things like lists in the webtop (hence the 80x80 pixel dimensions).
In most websites/apps you’d usually you come up with a design that will require certain image sizes / aspect ratios, and so you’ll want to override dmImage to set specific image dimensions, or even add new properties so that you have new pre-defined crop sizes, e.g. Hero Image, Card Image, etc. Once the properties are defined in your component, the system will take care of automatically cropping them, which makes it easier for the user to simply upload a “source image” and let the system take care of all the specific crops to the various sizes.
You can specify an empty value for ftImageWidth and ftImageHeight when you override dmImage, but in my experience it’s vary rare to have that requirement unless it’s for a Source Image property.
Thank you for the pointers. I will play around with those settings. Then, I guess, the only thing that remains to be seen is the duplicate issue. But perhaps this will solve itself, too, after I tried out the improved dmImage settings.
I altered the dmImage CFC properties for the standard image according to your suggestions but left the thumbnail image settings as they were. Then I deleted all existing images and uploaded the big one as the source and the smaller one (680 px wide) as the standard image (now configured with a maximum width of 1200 px). I did not upload any thumbnail image.
As you can see from the screenshot below, the uploaded images have been copied to a “1” version, and then the “1” version has been stored as the new thumbnail image.
I can live with the result for now, knowing that I may delete the original uploaded images, but my guess is that this definitely is a bug.