Can’t access image uploaded with WP_Image_Editor using php file_exist function.
-
Hi,
I am developing a podcast theme where i have a form that allows the user to upload their podcast cover arts. The Podcast cover art’s dimension should fall under 1400×1400 and 3000×3000 since we are following iTune’s regulations.
Since such big files will impact the page load speed of the site i wanna resize the uploaded image to a smaller size, say 250×250 so that we can use that to display on our web pages.
I have usedWP_Image_Editor::resize
function to resize the uploaded image andWP_Image_Editor::save
function to save it. It actually worked. I now have two different images with two different dimensions.
Since a lot of our user’s have already posted their podcast with the bigger images, i simply cannot exclusively show the compressed version. Instead i wanna check if a compressed version exists or not and show the image accordingly.
I have used PHP’sfile_exists
function to check for the compressed version of the images. But it seems, it always returns false in the case of compressed images. But i can access it through the browser by typing in the full address.file_exists('path/to/original_image'); = true file_exists('path/to/compressed_image'); = false
I have used
wp_handle_upload()
to upload the original image butwp_image_editor
class to resize and save the compressed one. So there must be something different with these two functions that’s causing this issue.Do you guys have any idea, how i can get over this ? Any help would be greatly appreciated.
Thanks in advance.
- The topic ‘Can’t access image uploaded with WP_Image_Editor using php file_exist function.’ is closed to new replies.