Skip to main content
For reference only. Please use a different board for new questions

Using 404 caching for images

More
12 years 1 month ago #393 by redactie

Jort wrote:

Code:
define ('DF_IMAGE','concat("https://www.website.nl/img/",`feed_id`,"/",crc32(image),"-",`items_id`,".jpg")');

did you adjust the img/index.php for the usage of the crc32 function ( example is in the img/index.php )

The following user(s) said Thank You: Jort

Please Log in to join the conversation.

More
12 years 1 month ago - 12 years 1 month ago #394 by Jort
Thanks, that was the issue. The same define as in the xhelpers.php should be enabled in the index.php
Code:
define ('DF_IMAGE','concat("https://www.website.nl/img/",`feed_id`,"/",crc32(image),"-",`items_id`,".jpg")');
Last edit: 12 years 1 month ago by Jort.

Please Log in to join the conversation.

More
12 years 1 month ago - 12 years 1 month ago #396 by Jort
Is it also possible to create different sizes (using percentages) for the thumbs based on the original height and width? The publishers never use the same imagesize. In the index you'll have to specify a height and width, but in pixels the proportions are not right for every image when displayed.
Last edit: 12 years 1 month ago by Jort.

Please Log in to join the conversation.

More
12 years 1 month ago #397 by redactie
The 404 script should resize with the correct aspect ratio, adding white space to get the right size.

This could get ugly on a website with a coloured background, although a lot of images have white background already.

the 404 script could be changed to resize only, best fit, without adding white-space.

or the background color for the padding can be changed
Code:
#no padding 1 $dst_img=ImageCreateTrueColor($new_x,$new_y); imagealphablending($dst_img, true); # black is white $white = imagecolorallocate($dst_img, 0, 0, 0); imagefill($dst_img,0,0,$white); #no padding 2 imagecopyresampled($dst_img,$src_img,0,0,0,0,$new_x,$new_y,$old_w,$old_h);



the 404 script has been updated including these examples, and a fix for image urls with encoded '&'

Please Log in to join the conversation.

More
12 years 1 month ago #541 by Jort
I still can get it perfect. Some images show the "no-image", but i see the image is in the folder. The script is looking for this url: www.example.com/img/56/255996879-132466.jpg but cant find it.

When i enter the url, in the browser, without 255996879- it shows the image correct.

Whats happening here?

Please Log in to join the conversation.

More
12 years 1 month ago #542 by redactie
The pevios version of the script missed a vital part to compile the directory correctly.

the zip is updated

Please Log in to join the conversation.

Time to create page: 0.428 seconds