Advanced SEO
Forum Replies Created
-
Forum: Hacks
In reply to: How to compress original image during upload?I tried to add this to my functions:
add_filter('image_strip_meta', function( $bool ) { return false; });
but nothing, WP still create medium and thumbnail versions of original image with EXIF data.
I hoped it will have same influence on original image when I apply my function for compressing original image, but than EXIF is removed from all images.
Am I doing something wrong?
Forum: Hacks
In reply to: How to compress original image during upload?Hello.
WP released 4.5 today :-).
I made some tests, default jpeg compression is changed from 90% to 82%, just 8%, but on my test on 4.4.2 medium sized image was 133kb, and same image on 4.5 is 91kb, without noticeable loss in quality.I can see new filters about images, but I am not sure how to use it. If I am right it is used to keepe/strip EXIF/IPTC data on resized images (if ImageMagic is used).
I am using ImageMagic, but what I need is to compress original image too, and to keep EXIF on original image, so far I can see all this is for medium and thumbnails.
Am I right?
When I apply function above for compression original image, EXIF is removed from all images (original, medium, thumb).
Any idea how to change function above to keep EXIF?
Best regards.
I just tested your plugin. As I can see EXIF/IPTC data are removed after optimization, except GPS location and original creation date and time, for JPG files.
Could you please think to update plugin to provide option to preserve EXIF/IPTC (just in original image would be fine)?
Best regards.
Forum: Hacks
In reply to: How to compress original image during upload?I tested and imagick is in use. Word Press create medium and thumbnail sized image with EXIF/IPTC data in images.
Problem is with my function which compress original image (see above, 1. post) when function is commented out, I get EXIF on all images, including medium and thumbnail size. When function is ON EXIF is lost in all images, including original.
Any fix to compress function?
Forum: Hacks
In reply to: How to compress original image during upload?ImageMagick and the Imagick PHP extension is installed on my host.
Also I added this function to WP theme functions:add_filter('wp_image_editors', 'bc_force_imagick'); function bc_force_imagick( $editors ) { unset( $editors[1] ); //remove GD from array return $editors; }
But, still generated images are without EXIF data.
How can I be sure WP is using ImageMagick instead GD (I have both now)
And, it it is using ImageMagick, how to tell WP/ImageMagick to keep EXIF?Forum: Hacks
In reply to: How to compress original image during upload?So, ImageMagic php extension will use slightly less than what GD is using now when processing image?
I am using GD now, and I have no any problems, even with large images.
I have images up to 30 MP uploaded to WordPress, even my php memory limit (from php info is now 128 MB) and WordPress memory limit (inside wp-config.php is 96 MB).Thank you for great support.
Forum: Hacks
In reply to: How to compress original image during upload?So, I need both ImageMagick and the Imagick PHP extension for WordPress to be able to resize uploaded images?
If I understood right that ImageMagic PHP extension is insanely memory-hungry PHP extension?
Will that consume my memory all the time or just in moment while WP generate thumbnails, resize, crop images?
How much memory it will consume, some example?Forum: Hacks
In reply to: How to compress original image during upload?Could you please explain this?
“It is an insanely memory-hungry extension“I have good VPS with excellent full managed support, so I am sure my hosting company will install it on my VPS for me if I ask.
I was looking for posts about ImageMagic vs GD:
ImageMagick vs GD – which is faster, less resource intensive and produces better images?
Which is better: GD or Imagick?It looks like, ImageMagic is better, and not “an insanely memory-hungry extension” (according to some sources it use even less memory than GD).
In my case in needs just to resize original uploaded image to Word Press and create thumbnails.Off course, main and only reason to switch to ImageMagic is to keep EXIF info in image (look at first post code).
I will contact my hosting company and ask them for opinion and to install ImageMagic. I will post results here.
If there is anything else I should know, please write.
Thanks.Forum: Hacks
In reply to: How to compress original image during upload?Thank you for your help.
I just checked (using php info file), and I can see this:GD Support enabled
GD Version bundled (2.1.0 compatible)
…But I can not find “imagemagick” or “imagick” in phpinfo output. Than
I used this code to check if it is installed:// Check if imagick is loaded if(extension_loaded('imagick')) { echo 'Imagick loaded.'; } else { echo 'Imagick NOT loaded.'; }
And I get this “Imagick NOT loaded.”.
I guess I need to contact my hosting company to enable imagick? Is there anything else I should do, after that?
Hello.
Thanks for reply.
This is original:
if( isset( $this->params["hauth_return_to"] ) ){ Hybrid_Auth::storage()->set( "hauth_session.{$this->id}.hauth_return_to", $this->params["hauth_return_to"] ); }
Should I replace it or just to add your code above like this:
// Added start if ($this->id=="Live") { $this->params["login_done"] = $HYBRID_AUTH_URL_BASE."endpoints/live.php"; } else { $this->params["login_done"] = $HYBRID_AUTH_URL_BASE . ( strpos( $HYBRID_AUTH_URL_BASE, '?' ) ? '&' : '?' ) . "hauth.done={$this->id}"; } // Added end if( isset( $this->params["hauth_return_to"] ) ){ Hybrid_Auth::storage()->set( "hauth_session.{$this->id}.hauth_return_to", $this->params["hauth_return_to"] ); }
Forum: Fixing WordPress
In reply to: Most used uunique custom field values?Hello.
Thank you for your answer. I thought it is not an easy process and I am not “very awesome” with PHP. After reading your explanation I can imagine how complicated is that.
Also, I thought it could be resources consuming, there is 25000 posts with that custom field. I thought, I could on custom page template generate list of popular colors once, and then cache it, or manually create display for further use. After all, list of 100 most used colors, based on 25000 posts, is not going to change a lot with new posts.
So, if you have time, good will and if this is good enough challenge for you I would appreciate if you can make that for me.
If you have any suggestion, or proposition how this can be done, please do not hesitate to tell.
Best regards.
Forum: Fixing WordPress
In reply to: Display custom field value part by part?This is working (trim the $colors before use):
if ( get_post_meta( get_the_ID(), 'colors', true ) ) { $colors = get_post_meta( get_the_ID(), 'colors', true ); $colors = explode( ' ' , trim( $colors ) ); // Trim the $colors before use: foreach( $colors as $color ) { echo '<div>'; echo $color; echo '</div>'; } }
Thank you.
Forum: Fixing WordPress
In reply to: Display custom field value part by part?I changed my function for creating custom field value to use coma ‘,’ to separate colors like this:
<?php for ($i = 0; $i < $colors_to_show; $i += $inc) { for($j=0;$j<$inc;$j++) { $out_color_text .= ''.$colors_key[$i + $j].','; // CUSTOM FIELD VALUE } } $id = $post->ID; // Post ID $value = $out_color_text; add_post_meta($id, 'colors', $value, true); ?>
But it create custom field value like this:
00000,f0f0f0,c0c0c0,202020,404040,
with extra “,” at the end because, as you can see, function above do it like that.$out_color_text .= ''.$colors_key[$i + $j].','; // CUSTOM FIELD VALUE
Maybe yo can look at that function to make it create last code without separator or some way to strim/strip that last “,” before creating custom field value, or before reading it?
Forum: Fixing WordPress
In reply to: Display custom field value part by part?I managed to make custom field has value like this:
"000000 f0f0f0 c0c0c0 202020 404040 "
Now I have last empty div like this:
<div>000000</div> <div></div> <div>f0f0f0</div> <div></div> <div>c0c0c0</div> <div></div> <div>c0c0c0</div> <div></div> <div>404040</div> <div></div>
This is function which creates custom field value, please look at it.
<?php for ($i = 0; $i < $colors_to_show; $i += $inc) { for($j=0;$j<$inc;$j++) { $out_color_text .= ''.$colors_key[$i + $j].' '; // CUSTOM FIELD VALUE } } $id = $post->ID; // Post ID $value = $out_color_text; add_post_meta($id, 'colors', $value, true); ?>
Is it possible to make it create custom field without last white space?
Forum: Fixing WordPress
In reply to: Display custom field value part by part?My mistake. Custom field value was:
" 000000 f0f0f0 c0c0c0 202020 404040 "
White space on start and on end of field value. I will try to fix it in function which generate that field.Thank you, I will update as soon as I do this.