My website currently lets me upload 1 photo at a time for each of my listed vehicles. This process takes some time, and it would be convenient to be able to drop all photos into 1 field and have them upload properly. Any help is great!
<?php
if(isset($slider_image)){
if(!empty($slider_image)){
foreach($slider_image as $s){
?>
<div class="col-md-4 hide_me_<?php echo $s->id; ?>" style="margin-bottom:10px;">
<a href="<?php echo site_url('uploads/'.$s->image); ?>" class="lightbox">
<img src="<?php echo site_url('uploads/'.$s->image); ?>" alt="<?php echo $s->title; ?>" class="img-media ">
</a>
Remove Image
</div>
<?php
}
}
}
?>
Thanks,
Related
I have a PhP shopping cart for autoparts and I need to be able to enlarge the retrieved image upon clicking on it. The problem is I can't manually assign an ID to every picture because I'm echoing them from the database.
I've tried assigning one ID/class to all the pictures that get retrieved and enlarge them on click using the JS function but can't get it working.
$items_array = $db_controller->runQuery("SELECT * FROM mystuff ORDER BY ID ASC");
if (!empty($items_array)) {
foreach($items_array as $key=>$value){
?>
<div class="DisplayCartItems">
<form method="post" action="?action=add&mscode=<?php echo $product_array[$key]["mscode"]; ?>">
<img src="<?php echo $product_array[$key]["msimage"]; ?>" class="imgcartdisplay" align="alignnone"/> /* Right here I need some help */
<div class="lif"><strong>Category:</strong> <?php echo $product_array[$key]["mscategory"]; ?></div>
<div class="lif"><strong>Category №:</strong> <?php echo $product_array[$key]["mscatnum"]; ?></div>
<div class="lif"><strong>Stock №:</strong> <?php echo $product_array[$key]["msnomer"]; ?></div>
<div class="lif"><strong>Mark:</strong> <?php echo $product_array[$key]["msmark"]; ?></div>
<div class="lif"><strong>Model:</strong> <?php echo $product_array[$key]["msmodel"]; ?></div>
<div class="lif"><strong>Year:</strong> <?php echo $product_array[$key]["msyear"]; ?></div>
<div class="lif"><strong>Price:</strong> <?php echo "$".$product_array[$key]["msprice"]; ?></div>
<div style="text-align:center"><input type="number" name="oap" placeholder="Offer a price:"></div>
<br class="">
<div class="cartan">
Quantity: <input type="text" class="product-quantity" name="quantity" value="1" size="2" />
<br class="">
<input type="submit" onclick="AddCartAlert()" value="Add to cart" /></div>
</form>
</div>
<?php
}
}
?>```
I think if I can somehow assign an ID or class name for every picture that get displayed from the MySql and onclick change it's width/height, that'd do the job.
If I have correctly understood:
you should replace this:
<img src="<?php echo $product_array[$key]["msimage"]; ?>" class="imgcartdisplay" align="alignnone"/> /* Right here I need some help */
with:
<a target="_blank" href="<?php echo $product_array[$key]["msimage"]; ?>"><img src="<?php echo $product_array[$key]["msimage"]; ?>" class="imgcartdisplay" align="alignnone"/></a>
for opening the image in another tab.
Or... if you mean something like this https://lokeshdhakar.com/projects/lightbox2/#examples you have to use javascript (for example: Image #1)
In your case something like this: (of course you need to add lightbox script: https://lokeshdhakar.com/projects/lightbox2/#getting-started)
<a data-lightbox="image-1" data-title="My caption" href="<?php echo $product_array[$key]["msimage"]; ?>"><img src="<?php echo $product_array[$key]["msimage"]; ?>" class="imgcartdisplay" align="alignnone"/></a>
I am trying to make changes to product page of Opencart where I am trying to show a video instead of the product image. If I hardcode the video id I am able to play the video instead of the product image. but, I plan to take the video id from database table oc_product and new column u_tube_url to be defined and linked. currently in the default theme the path of image is defined in the image column. but, I want to give youtube videoid instead of image path.
I think the changes has to be done in product page at
/catalog/view/theme/default/template/product/product.tpl
<?php if ($thumb || $images) { ?>
<ul class="thumbnails">
<?php if ($thumb) { ?>
<li>
<a class="thumbnail" href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>">
<img src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" />
</a>
</li>
<?php } ?>
</ul>
<?php } ?>
I also think some changes might be required at /catalog/controller/product/product.php
I added a db column in product description table. then...
I made changes to include video instead of product image.
Step 1
Open file: catalog/view/theme/default/template/product/product.tpl
Find :
<li><a class="thumbnail" href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>"><img src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a></li>
Replace:
<li><a <embed src="http://www.youtube.com/embed/<?php echo $url_id; ?>?autoplay=0&rel=0" width="360" height="240"></embed></a><embed src="http://www.youtube.com/embed/<?php echo $url_id; ?>?autoplay=0&rel=0" width="360" height="240"></embed></li>
Step 2
Open file: admin/model/catalog/product.php
Add to :
url_id = '" . $this->db->escape($value['url_id']) . "',
Step 3
Open file: catalog/controller/product/product.php
Find :
$data['heading_title'] = $product_info['name'];
Add after :
$data['url_id'] = $product_info['url_id'];
Step 4
Open file: catalog/controller/product/product.php
Find :
'special' => $special,
Add after :
'url_id' => $result['url_id'],
Step 5
Open file: catalog/model/catalog/product.php
Find :
'description' => $query->row['description'],
Add after :
'url_id'=> $query->row['url_id'],
I have written a PHP on a page displaying info from an XML feed to another website. On the feed I have a product image that we would like to display, but I need to add the external website address as a prefix in order for this to work.
Code I have on the feed is:
$xml = simplexml_load_file('feed/myfeed.xml');
foreach ($xml->item as $item) {
$short_description = substr($item->descshort, 0, 200); ?>
<div class="row">
<div class="lhs col-md-9">
<h3><?php echo $item->name ?></h3>
<p class="pri">£<?php echo $item->regprice ?></p>
<p id="shown">
<?php echo $short_description; ?> ... Read more</p>
</div>
<div class="rhs col-md-3"> //The following is the bit that I am struggling on
<img src="<?php echo 'http://mywebsite.com/myimagefolder/mysubimagefolder/' . $item->imgsm; ?>" alt="<?php echo $item->name ?>" height="150" />
</div>
</div>
But all this gives me is a warning message that I have just tried to access http://mywebsite.com/myimagefolder/mysubimagefolder/
So basically how could I add http://mywebsite.com/myimagefolder/mysubimagefolder/ on the beginning and the filename after it?
Its probably very simple, but not to me. Please could anyone help me?
Many thanks in advance.
I have just tried:
<img src="http://mywebsite.com/myfolder/mysubfolder/<?php echo $url, $item->imgsml ?>" alt="<?php echo $item->name ?>" height="150" />
And this seems to work throughout. And this seems to work throughout. Thanks #schenk, your answer was spot on.
I find this com_content/views/article/tmpl/default.php I created a template override and here is the code:
<?php if ($params->get('access-view')):?>
<?php if (isset($images->image_fulltext) && !empty($images->image_fulltext)) : ?>
<?php $imgfloat = (empty($images->float_fulltext)) ? $params->get('float_fulltext') : $images->float_fulltext; ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image">
<img
<?php if ($images->image_fulltext_caption):
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_fulltext_caption) . '"';
endif; ?>
src="<?php echo htmlspecialchars($images->image_fulltext); ?>" alt="<?php echo htmlspecialchars($images->image_fulltext_alt); ?>"/> </div>
<?php endif; ?>
Before img tag how to form, modify this php code to be clickable the image to self url:
<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>"> <img
Here is the resolution:
<a href="<?php echo JURI::root().$images->image_fulltext; ?>">
Now the image is "clickalble" to self url
JURI::root() > your webpage url (like: something.com)
$images->image_fulltext > in joomla 3.1 you can choose an image what is displayed when you click to readmore, ie when you read the full article, that image have an url, like: /images/stories/freshsite/something.jpg
This php code combines these two code, to be: something.com/images/stories/freshsite/something.jpg > when you click on the image, only this image will shows in you browser :)
I need a small amount of help to start developing a script to get the color labels on list products in Magento. I do not want to switch the pictures on click, I simply want to show that there is more than 1 color available on that particular product.
Ok, i get the final script, but i cannot get the result of pictures below
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(155); ?>" width="155" height="155" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
</a>
Script to get the associated images on list.
<?php $_images = Mage::getModel('catalog/product')->load($_product->getId())->getMediaGalleryImages();?>
<?php if($_images){?>
<?php $i=0; foreach($_images as $_image){ $i++;?>
<a href="#">
<img src="<?=$this->helper('catalog/image')->init($_product, 'thumbnail', $_image->getFile())->resize(200, 130); ?>” width="200" height="130" alt="<?=$this->htmlEscape($_image->getLabel());?>" title="<?=$this->htmlEscape($_image->getLabel());?>" />
</a>
<?php }?>
<?php }?>
The script from the question is working perfect, just not the right place to explode it.