Website Images - Loss of quality - php

The images on my web page seem to "lose" quality / color in thumbnail sizing.
Link To Site
I have tried to insert the following to prevent Wordpress from compression the images - I then regenerated thumbnails, howver problem still exists.
The images display correctly upon opening - the error is with the thumbnails
add_filter('jpeg_quality', function($arg){return 100;});
I have also tried setting the plugin "imsanity" quality to 100 - and also tried deactiving the plugin and reuploading new files. So I am doubtful this is the problem.
I am using DIVI theme. have tried DIVI support who believe the problem is not with the theme.
any advice please? Thank you

Related

PDF file randomly breaks upon upload on WordPress

The issue randomly started happening. When I upload a PDF file via the media library, it sometimes 'adds' random lines and graphics to the PDF file(or solid brown color), but sometimes it is okay.
WP core is updated to latest, plugins as well, php is running 7.3.
I wonder if it is ever Wordpress issue or a hosting issue.
What could be the reason?
here's the list of the plugins:
Abandoned Cart Lite for WooCommerce
Advanced Custom Fields PRO
Advanced Order Export For WooCommerce
Contact Form 7
LionScripts: IP Blocker Lite
Mouseflow for Wordpress
MultiLine files for Contact Form 7
NotificationX
Post SMTP
Really Simple SSL
SVG Support
WooCommerce
WooCommerce Order Status Control
WooCommerce Order Status Manager
WooCommerce Stripe Gateway
WP Cerber Security, Anti-spam & Malware Scan
WP-PageNavi
Yoast SEO Premium
Which one has a chance to be the problem?
here's what the broken PDF looks like(only one of the pages, other ones are fine actually:
Also, the XHR Request sometimes responds with JSON data, and sometimes the response is empty. This is all RANDOM, i.e. it happens on every 2nd or third upload(through the ACF File field), very weird bug.
EDIT: I have found it is not inserting _wp_attachment_metadata in the wp_postmeta table(it works only through media library, but not from the acf file field)
EDIT 2 : Just found out it breaks png and jpg images on upload too
EDIT 3 : It does the same thing on blank WP installation on the BASIC media upload

Undo Removed Featured Images from database wordpress

I was editing my WordPress theme and editing function.php
I used a code for not loading featured image file. but it seems the code removed the ability of loading featured image from database
i found the topic here and used it:
http://spicemailer.com/wordpress/how-to-remove-featured-image-from-all-posts-wordpress/
how can i Undo it?
It seems it has removed the link of my database to featured image,
now there is no featured image in edit pages/posts of wordpress
all my websites images which were features images are not displaying
my website is : http://www.aryagostarafzar.com
please help me how to undo and set the link againg
my last backup is for a week ago and i will lose many things
I had a look at the article. Unfortunately there is no reverse code for this situation as the query has deleted the records in the database.
If you had taken a backup of your database before running this query, you can restore it.
Otherwise, as mentioned in the articles your images are still available in the media library. So, you have to edit each post again and set the featured image on individual posts.

Wordpress thumbnail sizes

In my functions.php i defined 2 dimensions i want to use on my site, small and custom-size and my file looks like this:
add_theme_support('post-thumbnails');
add_image_size('small', 120, '', true);
add_image_size('custom-size', 755, 220, true);
When i check my wp-content/uploads folder, except original image and 120px and 755px images i see several others dimensions (150px, 768px) and i was wondering why is that showing if i only have 2 dimensions (i am asking because i am on limited hosting and want to save on disk space because i host a lot of images).
Thank you!
There are generally three reasons that these other sizes could be showing up:
You had different thumbnail dimensions / image sizes in the past. Images are not re-created (or deleted) when you change image sizes, but you can use a plugin such as Regenerate Thumbnails to do this for you - just click the options it adds under the Tools menu, after you have changed your image sizes.
You have a plugin or theme installed that is creating additional image sizes. To track down what is doing this, you can either search through the files for add_image_size, or you could deactive plugins/change themes and then regenerate your thumbnails to see what the result is.
Wordpress has a new hidden image size for responsive images. This applies in the case of the 768px image. See this WP Core blog post for details. If you have no need for responsive images you could change the size that applies to this image using the instructions in that blog post (running eg. update_option('medium_large_size_w', '755') or even manually updating the option in the database - it's in the wp_options table). Again - regenerate thumbnails after doing this.

Product Image resolution issue woocommerce / wordpress

Getting an issue with either Wordpress or Woocommerce.
Yesterday I updated Woocommerce as I was installing a new theme. The issue I have come across now is that I can't change the image resolution to be better quality on the product page.
So, just to give a quick run down, I have installed a new theme and updated woocommerce.
But for some reason the image quality is rubbish, For example, this page https://www.gogadgets.ie/shop/android-tv-boxes/mxq-android-tv-box/
The image is of low quality even though the original uploaded is 750x750px. I went to the settings for Woocommerce and changed the dimensions - funnily enough when I save the image size settings they revert back to the default setting which is 433x325px.
Could this be a database issue or is there any type of file I can upload to the site that could override any image dimension settings for the main product image?
I know the css is good for the theme as there is no quality issues on their demo site.
Hope I have given enough information and this makes sense.
Thanks
If the woocommerce image size settings are automatically overridden, then it might be because they are overridden from the theme settings. Media Center is a good theme. You might be able to find the settings within
'MCOptions > Shop > Product Item Settings`

Php image resize/thumbnail approach for (Wordpress)

My goal is to create a website for a client that needs the site to be heavily based as image galleries.
I am making the site through Wordpress so the client can upload the pictures through the friendly wordpress admin panel and then the site will display a parent image for the gallery and several thumbnails (scrolling with Jquery).
My question is for advice on good ways to resize the images as thumbnails. Currently I have some "hack-ish" code that simply changes the image dimensions, but as far as I know this doesn't reduce loading time and is quite inefficient.
Any ides on how to do it better? Possibly by using PHP GD? Thanks!
Wordpress already does this on successful upload.
Besides creating the standard set of thumbnail, medium and large sizes, you can also enter custom sizes to create under the Settings -> Media section of the dashboard.
You can also add custom sizes in plugins and / or themes. See http://codex.wordpress.org/Function_Reference/add_image_size
Timthumb might be a good solution for this. The built-in wordpress media settings can only be set once for three different image options (thumbnail, medium and large). If you change the settings, anything already uploaded won't be readjusted. Most of the time this is acceptable, but for a photo heavy site, you might need more size options and dynamic adjustments. This simple php script will create any size image and save a cache copy for quick delivery. Lots of WordPress themes use it.
http://code.google.com/p/timthumb/
-- EDIT --
So, you know that advice about TimThumb I gave yesterday? Well, check out the big news today. Just make sure you're using the latest version.
http://ma.tt/2011/08/the-timthumb-saga/
WordPress his this nifty function tucked away image_resize, I'd recommend that if your looking to do this on the code size in one location. I have a small "library" I wrote to "help" with handling file uploads in WordPress, the git repo is here.

Categories