I've written an extension for MediaWiki that creates slideshow for images.
The problem is that while the image is used in the slideshow it doesn't show it is being used on the file page. How can I add page reference to File Usage section?
You need to add the image to the list of images in the ParserOutput object. You can get a ParserOutput object by calling $parser->getOutput(), and add an image to it with $parserOutput->addImage( $name ).
Related
We have a shop page on this website.
I will explain my problem using the very first image in the top left as example, although it applies to all of them.
If you hover over the first image (Gentes Deluxified English) you see an incomplete picture like this:
src= ".../Gentes-board-DLX-20180123-200x267.jpg"
This image actually cuts of parts of the images to the left and right. The full image is like this:
src= " .../Gentes-board-DLX-20180123.jpg"
So we want to change the thumbnail image to the full image, or keep the original ratio of the image. This needs to work for all images and the ones added in the future.
Is this fixable with css?
I already spent a lot of time looking at the source code of woocommerce to find the file that creates the page that uses the thumbnail images. I can't find that file. Where should I look for the source code files? And what should I change in these source files?
I looked at the source code of Woo commerce and found the parameter for cropping thumbnails for you.
https://github.com/woocommerce/woocommerce/blob/master/includes/class-wc-regenerate-images.php
Add this
$crop = false;
after line 318:
private static function get_image( $fullsizepath, $thumbnail_width, $thumbnail_height, $crop ) {
i am displaying an image usign readfile() function of php
HMTL:
<img src='image.php?id=232'/>
PHP: image.php
<?php
$id=$_GET["id"];
if(image_view_allow($id)){
$path=get_image_path($id);
readfile($path);
}else{
readfile("images/not_allow.png");
}
image_view_allow and get_image_path is two that i have defined to check validation and get path
I am doing this because i want show image only to the allow person.
Does this affect speed of downloading an image ?
what is normal(means direct path in src attribute of img tag) or trick that is shown above?
Just loading an image probably same,but it is always better if you handle images with php, because when you resize image with php you load the needed size. But with html you load the bigger size than you need and resize.
first -> Does this affect speed of downloading an image ?
answer: no, because when the page is loaded, the php code is already translated to html before page is loaded in the borwser.
second -> what is normal(means direct path in src attribute of img tag) or trick that is shown above?
answer: both are same as both involve php code. When code executes in either way it will enter the source of the image in the image tag.
There is an image inside HTML page. I use Jquery for 360 grad rotation. My Jquery plugin gets the list of all images via AJAX request. But the problem is, that I don't know where the user will locate scripts ang images.
For example images will be located at home/mypage/public_html/gallery/pictures/ and scripts at home/mypage/public_html/scripts/rotate/. I have an option for user to show the path to scripts and want the script to get images path automatic, based on first image path.
For example I have some image with relative path:
<img src='pictures/001.jpg'>
url is: mypage.com/gallery/pictures/001.jpg
How can I get a path to containing folder in form:
home/mypage/public_html/gallery/pictures/
It's no matter to do it with Jquery or PHP
a PHP script then loads all images from home/mypage/public_html/gallery/pictures/
Thx!
<img src='<?php echo $_SERVER['DOCUMENT_ROOT'] ?>/gallery/pictures/001.jpg'>
try this
In the end it depends on whether you process your data on the server side (PHP) or on the client side (JavaScript), but you need to use the getcwd() PHP function:
http://il.php.net/manual/en/function.getcwd.php
So you can pass the relative image path to PHP through jQuery, and then append the current working directory (getcwd) to the beginning.
How about this:
$_SERVER['DOCUMENT_ROOT'];
Path of mypage.com\ plus gallery\pictures plus Image name
How do you remove the image in OpenTBS if the one you are replacing it with does not exist?
I have a bit of code that loops through and replaces pics in a table, but sometimes the client will not have the pictures. I tried leaving out the default=current tag but it shows a missing image box("This image cannot currently be displayed").
UPDATE:
I thought Skrols answer would work but I couldnt get it to work. I have an image followed by the following tag.
[field.p5;ope=changepic;from=’[val]’;adjust]
Whats tags following this would i have to use to say if the field variable p5 is not set or empty ect then remove the image.
If your first need is to not change the picture in the Docx if the target picture is a not found file, then they are two solutions:
First try with the latest OpenTBS version (1.7.4) because it claims to fix a bug about "default=current"
If it does not work, then you have to check at the PHP side if the target picture does exist using file_exists(). If it doesn't exist then change the target picture path with a new file that you are sure it does exist.
If you prefer to delete the picture box in the document if the file is missing, then you can add a TBS field that will delete the picture box depending to a global variable.
PHP:
$picok = (file_exists($the_picture)) ? 1 : 0;
HTML:
[onshow;block=w:drawing;when [var.picok]=1]
I am constructing a lighbox gallery, currently experimenting with FancyBox (http://fancybox.net) and ColorBox (http://colorpowered.com/colorbox).
By default you have to include a link to the large version of the image so that the Lightbox can display it. However, I am wanting to have the image link URLs pointing to a script rather than directly to the image file. So for example, instead of:
<a href="mysite/images/myimage.jpg">
I want to do:
<a href="mysite/photos/view/abc123">
The above URL points to a function:
public function actionPhotos($view)
{
$photo=Photo::model()->find('name=:name', array(':name'=>$view));
if(!empty($photo))
{
$user=$photo->user;
$this->renderPartial('_photo', array('user'=>$user, 'photo'=>$photo, true));
}
}
At some point in the future the function will also update the view count of the image.
Now this approach is working to an extent - most images load up but some do not load up (the lightbox gets displayed in a malformed state). I think the reason for this is because it is not processing the function quick enough. For example when I click the "next" button it needs to go to the URL, process the function and retreive/output the response.
Does anybody know how I can get this working properly?
I added "width" and "height" attributes on my image tags and it works fine now.