laravel 5.2 thumbs on the fly - image

I am using a class which requires 3 things to be declared. It will make thumbs on the fly (ImageMaker.php). I have placed this in the public directory renamed to IM.php and my images are in the public area also in a subdirectory called images.
Image maker requires 3 things to be declared:
define('IMAGEMANIPULATOR_CACHE', "/_cache" ); # Relative to this file path without trailing or prepending slash; don't forget to set the right permissions to this directory
define('IMAGEMANIPULATOR_BACKUP', "/images/backup.jpg" ); # The image to display when on the fly image isn't found; relative to this file path without prepending slash
define('IMAGEMANIPULATOR_PATH', "/images"); # The folder to look for images in when displaying images on the fly; without prepending or trailing slash
To show an image the souce becomes
IM.php?onthefly=filename&resize=0,60
I have used this is a non-laveral environment without problem. The image names (without a path) are from a table and I will be using this in datatables.
So in theory it becomes
<img src="IM.php?onthefly={{ $items['url'] }}&resize=0,60">
except it does not work!
This is in a view.
Help appreciated!

Related

Prevent MyST from changing .md image paths

I'm generating sphinx documentation with.md files that reference images via relative paths:
![](../_static/figures/image.png)
I use MyST to parse the .md files into html, but it removes the ../' making all paths:
_static/figures/image.png.
The relative paths work fine before documentation generation and has to kept the same.
In the conf.py for sphinx I copy over the images as html_static_path files, and if the path is kept the same in the html, the images would show.
The MyST docs state that it copies .md images but give no configuration options for copying. The paragraphs below only reference how to parse HTML files with images. I did find another option that should treat all links as hyperlinks, but this made no change.
How do I force MyST to not change the image paths?
I think it is more of a convention question.
It is recommended to put _static in all folder levels and separate assets like images inside each of them, so that links like _static/figures/image.png resolve to just that folder level.
If you want to use a single top level _static folder for all folder levels, then your links should be written as /_static/figures/image.png, where they are resolved to the top level.

Laravel 8 UniSharp File Manager 3 - image uploaded but not showing

When I upload some files with LFM, the images are uploaded in a new folder created in storage/app/public/photos/shares and thumbnails in a nested folder thumbs. BUT the images thumbnails are not showing in the FM, only the filenames under a blank image.
1/ How can I fix that?
2/ Under the images there is a little blue box with number 1 inside . What is that? I can I get rid of it?
3/ I also find strange that the images are stored in a "shared" folder although this is set to false in the /config/lfm.php. Do I have to edit unisharp/laravel-filemanager/src/config/lfm.php as well? Or should I delete the one in /config?
'allow_shared_folder' => false,
'shared_folder_name' => 'shares',
4/ I also do not want that location for the upload. Instead I want the images stored in /public/images/uploads and same for the files into /public/files/uploads. Where do I change these paths?
change your APP_URL="localhost" to your port (for ex : APP_URL=http://127.0.0.1:8000)
In config folder
open filesystem.php
replace './storage' instead of storage_path('app/public')

Vue markdown Image not displaying

I'm using the vue-markdown package to render markdown. It seems to work except the images don't display. The file path is correct as I can have an img show up correctly
<img src="#/assets/7801_4_lang_image.png"><!-- shows up -->
<vue-markdown>![img](#/assets/7801_4_lang_image.PNG)</vue-markdown><!-- doesn't show up -->
Changing the # to .. doesn't change anything either, the top one displays but the bottom one doesn't. The case of png/PNG also doesn't matter. Am I referencing the image wrong?
The file loader doesn't know about images in Markdown so Webpack doesn't know to bundle them.
Typically you need to require() the image source (see https://cli.vuejs.org/guide/html-and-static-assets.html#relative-path-imports)
You could try this but I'm not entirely sure if it will work with the vue-markdown component.
![img]({{ require('#/assets/7801_4_lang_image.PNG') }})
To use the source prop, you would use something like
<vue-markdown :source="`![img](${require('#/assets/7801_4_lang_image.PNG')})`">
See https://v2.vuejs.org/v2/guide/syntax.html#Attributes
You could also use the public folder who's contents are always bundled. For example, for a file public/images/7801_4_lang_image.PNG and assuming your app runs at the domain root
![img](/images/7801_4_lang_image.PNG)

Magmi is cannot find multiple images

I've Googled, and Stackoverflowed this to death (and checked the Wiki), but I can't find a solution to my problem :(
Problem:
With Magento Magmi: all products and single images are importing fine, the only catch is that Magmi throws the following error when I try to import multiple images (e.g. /BJ977L.png,/BJ977R.png):
Image attributes processor v1.0.25 - /BJ977L.png,/BJ977R.png cannot be found in images path
Obviously I checked and the files are there... Also, if I change it to only reference one image, then it works. I find this very confusing.
The images are located in: media/import and the Magmi Image Plugin configuration reflects this. Also, if I move the images to another folder, say var/import/images; then it makes no difference...
Your help is hugely appreciated!
Thanks in advance!
As the Images Attribute Processor documentation states, you should be using a semi-colon ; to separate multiple images.
/extraimg1.jpg;/extraimg2.jpg
Also ensure that the column names you are using are correct. media_gallery is the correct column header name for the media gallery images.
Have you tried using semi colon?
/BJ977L.png;/BJ977R.png
Have you tried using the complete file path to the images? Also, did you specify the file path root for the images in the plugin settings?
If you have formatted the .csv file the right way then you should check the Image Renaming setting for the Image attributes processor. If you specify a bad rule to rename your newly imported images you could end up with the same name for every picture. So basically the first image will be imported, then the second will overwrite it because it was given the same name. If you only see the last picture you specified for the media_gallery attribute then this is probably the cause.
Hope this helps.

Magmi won't update images

I'm using the datapump API - it works fine with my products, but now with updating images it won't work.
This is my array that Magmi doesn't like
array(5) {
["type"]=>
string(6) "simple"
["sku"]=>
string(6) "131017"
["image"]=>
string(76) "/ext/vhosts/site/subdomains/m/public/importer/../import/NO/A_131017.jpg"
["small_image"]=>
string(76) "/ext/vhosts/site/subdomains/m/public/importer/../import/NO/A_131017.jpg"
["thumbnail"]=>
string(76) "/ext/vhosts/site/subdomains/m/public/importer/../import/NO/A_131017.jpg"
}
When I imported my products, this worked fine, but there were descriptions etc. on
I have the following magmi settings:
using mode - Update existing items only,skip new ones
Image import mode - override existing images
Pre-download check for remote images - enabled
Assign only existing images - no
It seems like its a prerequisite of Magento import (and hence Magmi) that the images should be placed inside the media/import folder. So, regardless of where you run Magmi GUI from, the images should be placed inside the media/import folder. Moreover, if your images lie inside a folder inside media/import, you have to specify that in the import csv as well.
For example your images lie inside manufacturer-A folder, then you would have to also define on the image columns, the relevant folder path i.e. manufacturer-A/imagefilename.jpg
Plus, please be aware that it is a bad idea to have images named as 1.jpg, 2.jpg. Magento tries to create the subfolders for cacheing purposes using the first two letters in the filename. So a 1.jpg would ideally be placed inside 1/./1.jpg which is not possible because of the dot.
Note that when you define path for the images, it is not needed to define a full path just the relative path from the import folder (media/import) so in the example above, it is
manufacturer-A/image-1.jpg
and not
/ext/vhosts/site/subdomains/m/sitename/magento/media/import/manufacturer-A/image-1.jpg
Hope this helps. :-)

Resources