Keyword

Image cache questions

More
14 years 3 months ago #72563 by ansi.alpha
Replied by ansi.alpha on topic Image cache questions
just one mistake

$imgname = $file; replace it with

$imgname = substr($file ,0 ,-4);

 

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #72564 by B_Dark
Replied by B_Dark on topic Image cache questions
nice script but have low jpg quality why? i want 100% quality

ansi.alpha said:
if anyone still need another solution , you might try this.i made it to when i transferred my wordpress to joomla k2 "troublesome".1. make php file at the top of your joomla directory. "anything.php"2.copy and paste the code in it then check it in your browser and wait until it finish loading.3. when it finish loading, change the 2nd parameter of recreateImg function in the while loop with the k2 Width you variable you want.4.if you get error memory limit reach just refresh and it will continue from where it stop."it happens if your image has really high size"5.delete this php file when you are done creating all images you want.

NOTE: this doesn't create md5 names of images but it could with abit coding. and if your imagesdosn't have md5 names,your images wont work in your k2.<?php/** * $XS,$S,$M,$L,$XL,$Generic are k2 widths of new recreateImgd images in px . "you can find them in k2 panel" * you will need them change 2nd parameter of recreateImg function in the while loop after it finish generating files successfully. * probably not the default size setting. * if you change it ,change switch statment numbers to match them. */$XS = 133;$S = 409;$M = 745;$L = 766;$XL = 1066;$Generic = 300;//path to src folder of your images$srcPath = "./media/k2/items/src/";function recreateImg($file, $k2Width){    global $srcPath;    $imgPath = $srcPath . $file;    $imgname = $file;    // if you change k2 widths variables ,    // you will need to change numbers of each case to match them.    switch ($k2Width) {        case 133:            $size = 'XS';            break;        case 409:            $size = 'S';            break;        case 745:            $size = 'M';            break;        case 766:            $size = 'L';            break;        case 1066:            $size = 'XL';            break;        case 300:            $size = 'Generic';            break;    }    // the new image name and path to save it    $save = "./media/k2/items/cache/" . $imgname . '_' . $size . '.jpg';    if (file_exists($save)) {        echo $imgname . '_' . $size . '.jpg' . ' :Image exisit! <br/>';    } else {        $pic = imagecreatefromjpeg($imgPath);        $width = imagesx($pic);        $height = imagesy($pic);        $ratio = $k2Width / $width;        $newHeight = $height * $ratio;        $new_image = imagecreatetruecolor($k2Width, $newHeight);        imagecopyresampled($new_image, $pic, 0, 0, 0, 0, $k2Width, $newHeight, $width, $height);        imagedestroy($pic);        imagejpeg($new_image, $save);        imagedestroy($new_image);    }} // end of function//calling the function while looping each file if its jpg image$folder = opendir($srcPath);while ($file = readdir($folder)) {    if (substr($file, -4) == ".jpg") { //you can do images generations 1 size at one time by changing 2nd parameter .        recreateImg($file, $XS);    }}closedir($folder);?>

Please Log in or Create an account to join the conversation.

More
13 years 10 months ago #72565 by Roberto Céparo
Replied by Roberto Céparo on topic Image cache questions
hello here is the answer to manage image quality, cost me find out.

 search imagejpeg ($ new_image, $ save);replace imagejpeg ($ new_image, $ save, 100);replace quality by the number of such quality they want. 100 or 75.I'm from Argentina and my site is www.vodok.com.ar and I served

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #72566 by Russell English
Replied by Russell English on topic Image cache questions
@fidoboy that worked perfectly, thanks very much! great work!

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #72567 by Russell English
Replied by Russell English on topic Image cache questions
I'm having exactly the same issue.

In the end, I just removed all images (could do this as the images were only placeholder examples on a dev site) from /media/k2/items/cache and /media/k2/items/src

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #72568 by shenkwen
Replied by shenkwen on topic Re: Image cache questions
well, 3 years later I'm still having the same problem with k2 2.6.5, I can forecast this will be pretty annoying in the future once I have many articles and images.

Is there any official notes addressing this?

Please Log in or Create an account to join the conversation.

  • Christos Kougkouleris
  • Christos Kougkouleris's Avatar
  • Offline
  • New Member
More
12 years 1 month ago #72569 by Christos Kougkouleris
Replied by Christos Kougkouleris on topic Re: Image cache questions
Same problem here and it is a shame... I have a site with hundreds of articles per day, so that means thousand images per day as every image goes X 4...
I have no problem with disk space so when is the problem created? with number of files in cache folder?
Because I created a folder e.g. was_cache and moved a couple hundred of images from cache in there and then the image tab worked again... and after some days the same problem and just moved some images and then again everything worked....
So my question is... if I do whichever of the two solutions with the coding hack, as I do not have space problem will my problem be fixed or is there something else?
Please help me, someone, on this as I do not know where to look at...

Thank you in advance

Please Log in or Create an account to join the conversation.

More
12 years 1 month ago #72570 by BBC
Replied by BBC on topic Re: Image cache questions
It is really needed option. K2 tend to leave a lot of junk at server.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
12 years 1 month ago #72571 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Image cache questions
Hello there,

I think this code is a bit outdated. You can simply turn on the Force 'item modified date' as URL timestamp on image paths options on the advanced settings of K2. That way you won't need to clear the cache.

Please Log in or Create an account to join the conversation.

More
12 years 1 month ago #72572 by BBC
Replied by BBC on topic Re: Image cache questions

Krikor Boghossian wrote: Hello there,

I think this code is a bit outdated. You can simply turn on the Force 'item modified date' as URL timestamp on image paths options on the advanced settings of K2. That way you won't need to clear the cache.



Please stop spreading misinformations, this wont clean junk from disk. And decide for once if it will be image cache rebuild plugin, or not. It is your script, your own decision, but dont pull peoples legs.

Is there a way to rebuild the #K2 image cache easily? I think I've done and done something daft... #joomla
Reply Retweet Favorite More
1
Retweet
10:57 AM - 8 Sep 12
JoomlaWorks @joomlaworks 11 Sep

@antonydoyle Not really, but we do plan to launch a plugin soon to do just that, provided the source images are kept intact ;)
Details
1
Retweet
7:29 AM - 11 Sep 12 · Details

Please Log in or Create an account to join the conversation.

More
12 years 1 month ago #72573 by BBC
Replied by BBC on topic Re: Image cache questions
Want to say something different. For me main problem with lack of this function is not server space.
But it is those damn blurred images and thumbs when you change size of images in category settings.

You change Joomla template, want to adapt sizes of images to new template (to new space/block), and suddenly all thumbs and images are totally blurred. With no option to fix that problem, unless you want to go through hundreds of Items, delete Image and upload again. Because resize is done with HTML resize function.

Please Log in or Create an account to join the conversation.

  • Vagelis Varnakiotis
  • Vagelis Varnakiotis's Avatar
  • Offline
  • Junior Member
More
11 years 11 months ago #72574 by Vagelis Varnakiotis
Replied by Vagelis Varnakiotis on topic Re: Image cache questions
Now we have 2.6.6 of K2. But we still not have an answer, what is going on with the images.
For me the problem is that I have 17.000 images for 2000 articles and 1GB space only for these images. What will be after 6 months?
Big confusion.
Not a responsive answer.

Thank you

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago - 11 years 11 months ago #72575 by Hernan
Replied by Hernan on topic Re: Image cache questions
Hi, I had a big problem. The pictures of k2 media/k2/items/cache folder was removed alone. It happened to me once and i had to load all the pictures of the items k2. Today again, after several months of run correctly. The folder media/k2/items/src has the images inside.

Joomla 2.5.9
K2 2.6.6

Any idea how to generate the cache again?

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #72576 by Odin Mayland
Replied by Odin Mayland on topic Re: Image cache questions

Hernan wrote: Any idea how to generate the cache again?


Did you ever figure out how to get the cache generated again?

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #72577 by BBC

Please Log in or Create an account to join the conversation.

  • Jose orlando de lima
  • Jose orlando de lima's Avatar
  • Offline
  • Junior Member
More
11 years 11 months ago #72578 by Jose orlando de lima
Replied by Jose orlando de lima on topic Re: Image cache questions
its good??

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #72579 by Robert Deutz
Replied by Robert Deutz on topic Re: Image cache questions
Hi,

I created a php script for a image cache rebuild, you can find it here bit.ly/1aT8JcT

Cheers,
Robert

Please Log in or Create an account to join the conversation.

  • Jose orlando de lima
  • Jose orlando de lima's Avatar
  • Offline
  • Junior Member
More
11 years 11 months ago #72580 by Jose orlando de lima
Replied by Jose orlando de lima on topic Re: Image cache questions
How i run this script?? Sorry my question

Paste in

/public_html/My_site/media/k2/items only

Not

/public_html/My_site/media/k2/items/cache or

/public_html/My_site/media/k2/items/src

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #72581 by BBC
Replied by BBC on topic Re: Image cache questions
I bought a plugin from Styleware for this. Only 10 € and save you a lot of time.
It has its weakness, not respecting image resize override for categories, and you need to do process twice, or go direct in database and disable plugin. It act on reload / refresh in Admin panel when it is activated,

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #72582 by BBC
Replied by BBC on topic Re: Image cache questions
Can someone explain why Joomla (or say K2) doesnt have option to flush image presets ?
What is happening with Joomla core community. In Drupal, Wordpress it takes literally 2 clicks.

I cant understand where is Joomla heading at all. I am trying, but cant.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum