Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
I am having an problem I cannot seem to figure out.

Sometimes, it is necessary for me to upload an image twice to get it to show up in KCFinder.

THE IMAGE IS UPLOADED, but KCFinder can't "find" it. If I upload the image again, KCFinder will now display the second image, renamed properly some-image(1).jpg. I can then select it in KCFinder.

However, in my uploads folder I will have both images and thumbnails for some-image.jpg and some-image(1).jpg. And in the image address field in Couch, I can address and assign some-image.jpg, although for whatever reason KCFinder won't show it.

This does not occur with all images. Thus, confusion.
Hi,

Does this happen consistently with some particular images?
To test that, next time you come across this problem, please delete the hidden image (and its thumbnail) directly from the uploads folder and then try re-uploading it.

If the problem re-occurs with the same image, please PM the image to me. Perhaps it has something to do with the image's name.
1. I removed the base image and (1) copy image, and their thumbnails from the .thumbs directory.
2. I re-uploaded the image. The first upload succeeds, but does not appear in the browser. Thumbnail and image are in the uploads folder.
3. I upload it again, this succeeds. A (1) copy of the image (and thumbnail) are created and displayed in the browser.

Always the same images. Always repeatable.

You may fetch an example that does NOT work here:

https://www.dropbox.com/s/tbzr0lbi12did ... 0.jpg?dl=0

You may fetch an example that works here:

https://www.dropbox.com/s/ahhlvvsp2v16d ... w.png?dl=0

Thank you!
Thanks. I think I can see the problem and it has to do with the file name as I suspected.

As you know, you can make Couch create n number of thumbnails (using the type 'thumbnail' editable region).
These thumbnails are stored in the very same folder where the main image resides - however they are not shown by KCFinder (it would be confusing for the user to see, what would appear to her, the same image multiple times).

KCFinder's cue to hide the thumbnails is the way they are named by Couch; which is to add their dimensions (height and width) to the original name. For example, if the main image was russalvey.jpg, a very small thumbnail could be named russalvey-8x10.jpg.

I guess, you can see what is happening in your case - your problem image incidentally has a name format (russalvey-8x10.jpg) that suggests to CKFinder that it is a thumbnail and so it hides it.

The next time you upload the same image, a '(2)' gets appended to the new file and, since this no longer matches a thumbnail's name format, it gets displayed.

So the solution would be to alter the name of the original image slightly e.g. russalvey8x10.jpg or simply russalvey.jpg.

Hope this helps.
Thanks. We have, habitually, always tied important dimension information to our images (width, ratios, etc), so that we know what we are working with.

We can drop the dash, or change the x to "w", so:

image-8w10.jpg - image meta expressed as a ratio
image-100w.jpg - image meta expressed as a width only

Are those safe?
Curious, I played with the file names too and found the renaming helps. It wasn't long before I looked at PHP source and found the place. For curious minds, it's in /couch/includes/kcfinder/lib/helper_dir.php::173 (function get_couch_thumbs() ).

claycle wrote: We can drop the dash, or change the x to "w", so:

image-8w10.jpg - image meta expressed as a ratio
image-100w.jpg - image meta expressed as a width only

Are those safe?


The regex pattern for thumbs is \d{1,}x\d{1,})\ - i.e. you can avoid "x" between 2 numbers and it'll be safe.
6 posts Page 1 of 1
cron