I am currently using carrierwave-aws to upload to my S3 bucket.
One issue I am having is after the image is uploaded and saved, if the user, lets say changed something about the image locally and re-submitted for upload with the same file name, it will not reflect the new file uploaded.
The user has to change some part of the file name for it to show the correct one in my application.
I am assuming this is a caching issue but not sure where to begin to address this matter.
Has anyone else experienced this?
If your S3 bucket is set with a long or infinite expiry (which is a good idea for performance), you'll need to change the filename each time the image changes. See the Carrierwave wiki page on how to do this.
Related
When I add images it is stored inside google cloud platform VM correctly.
But I am not able to fetch newly added images in my website.
If I redeploy project with newly added images in assets folder it is showing correctly.
I have verified there is no mistake on frontend or backend side.
Is it not possible to get live image update with VM?
Edit:
I have used Vue.js.
I am storing images inside src/assets folder.
When I save images in my website it is saved at src/assets folder.
I think it can only access things in dist folder after build.
Can you suggest where should I save my file?
I'm making an educateg guess it's some cache issue.
Instead of putting your image files inside the VM you can try storing them in a bucket that's accessible to public. The downside is that it can serve only static files (no PHP or anything).
You have to configure your load balancer to forward all your.domain.com/images/ requests to the bucket but that's actually quite easy. Have a look at my answer asking for such configuration.
Hello Stack Overflow community, I have installed PrestaShop 1.6.0.14 in a Xampp server a few weeks ago for the company I work for. They have a web application that handles all the image files from their websites, for example, when a user opens an image with right click->open image in different tab or similar, the url shown is something like:
http://www.example.net/FileViewer/File.aspx?Type=3&File=WebsiteFileDirectory/img/logo.jpg&Width=138&Height=50
As you can see, after the &File= part comes a directory structure and some parameters to handle the image at the end. This directory (WebsiteFileDirectory) is located in C:/StorageFiles/Volume1/, where the web app for image handling looks for file sources.
My PrestaShop /img/ folder needs to be in that location with a directory structure similar to C:/StorageFolder/Volume1/PrestashopFileDirectory/img. So far, I've moved /img/ to that location and managed to make Prestashop write into the new location by editing the constant values _PS_IMG_, _PS_IMG_DIR_ and _PS_CORE_IMG_DIR_ in config/defines.inc.php and config/defines_uri.inc.php
But after that I've hit a brick wall when trying to make PrestaShop read from that location, I've even tried editing the LinkCore::getImageLink() method by hardcoding a uri_path value pointing to the directory mentioned before, with no results whatsoever, PS will try to read from the default location (something like myshop/16-small_default/image_filename.jpg)
How can I make PrestaShop read from that location? Is there even a way to do that?
Thanks in advance.
P.S.: Just to make sure I get a straight forward answer I want to let you know that by now I figured how the image file system in PS 1.6 works, if the image id is 25, PS will store the file in img/p/2/5/ for a product image, I have no problem with anything related to that.
Well, it turns out that getImageLink must be fed a URL (from the image handling webapp I mentioned before), not a filesystem path. So, the uri_path variable in this method would look like:
$uri_path = 'http://www.example.net/FileViewer/File.aspx?Type=3&File='.$my_img_directory.'&Width=138&Height=50';
The methods I have figured so far that need similar tweaking are getMediaLink and getCatImageLink, from the same Link class in the classes/Link.php file.
On my website Magento adds _1 to the end of some Image urls.
So my normal basic urls should be ...media/catalog/product/cache/9/A/E/test-small.png
but somehow for some images it alters to ...media/catalog/product/cache/9/A/E/test3-small_1.png
My normal image names are unique numbers so I´m confused why this happens?
Could anyone help?
Magento will add a _1 after any image if the file already exists on the server.
Please mind that Magento is not doing cleaning of the images of products when / if you delete one product.
It is magento's by default feature, if the image name you are trying to upload already exist it will rename your current image name with _Number. Check before uploading.
Thanks
If anyone comes across this post using M2 and is having the same issue. Check out the media/tmp folder. I was working on an api image sync and the name kept having a _1, _2 etc after the image.
It turns out Magento doesn't always give a clear reason if something fails in the api so the file was making it to the tmp directory but never the final destination causing the file name issue.
I've just inherited a rails site hosted on heroku using S3 for storage of images uploaded with the paperclip gem and suddenly most images are returning 403 errors. Looking at the bucket through the management console, I don't see the files listed even.
The images are uploaded through the ckeditor wysiwyg plugin, and it looks like they should be inside a folder named 'rich', but no such folder exists within the bucket. Not all files are missing (though some that were throwing a 403 are now showing up on the site correctly without me having done anything I can think of to change that), but none of them are listed in the management console.
I'm unfamiliar with S3 and not sure how to diagnose let alone resolve this issue. Any suggestions on steps I can do to figure out what the problem is would be appreciated, thanks.
Every time I've seen this error, it has been permissions:
Triple-check your AWS Access_key, Secret_key, and REGION
If you have any doubt about the keys, regenerate a new set to be sure you are using the correct keys.
If you end up changing any of them, remember to restart your server to re-read the values.
I have made an image upload page. this all works smooth.
My problem is when i upload an image called filename.jpg and i upload it again the same image uploads but changes the name to filename1.jpg
how can i force this and make a message with something like 'the image you upload was allready uploaded'
thanks
the change in filename was initiated by the os of server computer
to produce the promt you have to check the file name for duplicates while you are uploading
using the php script
if you have a database which stores the filenames then it is very easy