I have a site that has a script pulling images uploaded to a post and displaying it on their respective posts with the masonry script.
The issue is that I would like to have different widths on some "key images". The only thing that I thought of that could work is if there's a way to add a class to images being uploaded (before inserted).
For example under URL, Title, Caption etc.
Those classes could be radioboxes with small, medium or large.
Right now the only way to style images are after they're actually inserted in the post and I don't want to do that since they are never inserted and I don't want to mess up the text.
Does anyone have an idea?
Here's a link to a post for clarification.
http://www.lokalxxxarkitekter.com/web/projekt/broar-infrastruktur/kaptensbron/
Regards, Marcus
Related
I have a galery of users that show all of user photos. I want to have small thumbnails for each photos.
How to make it?
Also I notice some website even create thumbnail that focus on the face part of the original photos.
I don't have any code just looking for suggestions.
Im using PHP, Codeigniter, Angularjs, Jquery.
Thank you!
In your controller when receiving the file, before uploading it, you need to do some processing to it. each image you will save it in 4 or 3 sizes, it will be like this for image called imageHello.jpg:`
site.com/images/large/imageHello.jpg
site.com/images/small/imageHello.jpg
site.com/images/thump/imageHello.jpg
So basically it will be site.com/images/[size]/imageHello.jpg, in the front end side you will file the size with what you want based on the page.
for zooming you can use this library, look at this example
I'm looking for solution to a particular situation. In my theme each post is on a single page (single.php). Single page has a slider inside of the loop that is populated with attachment images. In that slider, I need to add some videos that are hosted on YouTube.
What I think I need is to write a plugin that allows to add YouTube URLs to a post in UI input fields in post editing window. These links would be then accessed using post id from single.php, so that I could loop through them, using foreach and render them as as html5 video.
I need a general advice on how this can be done. I've got a working slider that needs to host these videos along attachment images, but using attachment video does not work and it doesn't seem to be a viable solution (it's bandwidth intensive).
Any help is appreciated.
Thanks
I've sorted this out using a simpler approach, namely, I've used shortcodes to wrap content that's in the slider. It worked fine and saved plenty of time; it's more intuitive in comparison to using image attachments for creating the content, too.
I trying to resolve an issue that a friend of mine is having with an image heavy Wordpress site.
The site has multiple Custom Post Types and each Post Type has custom fields that allow multiple images to be uploaded.
The problem i'm trying to solve is this; The site has around 40,000 images, most of which are attached to the custom posts mentioned above, these images are used to showcase properties and are combined into preview pages to show to potential clients. Locating the correct images is difficult and i need to add some custom meta data to the images so make them easier to group/navigate.
Ideally i need to add the attachments parent post title into the alt or caption attributes for every image on the site.
Theoretically this would be done by using a default hook to add_filter('foo... I'm just not quite sure how to structure this so that it can run through all old images and future images.
A nudge in the right direction would be very appreciated.
WP_Image_Editor objects that you can perform operations on:
wp_save_image_editor_file
image_editor_save_pre
wp_save_image_editor_file
wp_image_editor_before_change
the first hook is triggered when an image is edited (crop/re-size whatever)
the second one is triggered when you crop/rotate the image and press the Save button (and it's a pre-filter)
for the 3rd one it is important to note that you should use $image->save( $filename, $mime_type ); inside your callback, or you will be left with an image that doesn't get saved. And if you want to do so, then better don't return the $saved with no value/NULL.
I have a WYSIWYG editor, which is used to create articles. The articles are then inserted into a database. The article is then displayed on the main page. It consists of 2 major divs/parts. The top part is a div with fixed height and is used to display an image that is submitted by the WYSIWYG(that's the plan) for the specific article. So, user(with privilege) writes article, inserts/uploads an image(which is located on the server), article gets inserted into DB and the url of the image as well.
My question is how I should display it? Right now I'm thinking of pulling all the required fields from the database and placing the image url into the div and it will render as an image. This feels really clunky, so with my limited experience I wonder if there's a more elegant way to do it.
You're on the right track. Pull the image URL from the database, then pop it into an img tag within the div, OR apply it as a background on the div itself.
For sizing the image to fit in the div, specify either the height or width of the image. The other will automatically size, keeping the proper aspect ratio. This can cause problems with it fitting in the div of a fixed height, so you will want to set the CSS overflow property on the div to hidden, so that images do not overflow outside of it.
You mean storing the image path in a DB then echoing it in an tag?
There's nothing wrong with that... better than storing the image in the DB if that's what you were wondering?
I've built a php CMS and for my news page I want the option to either add one main image or the possibility of multiple images at the bottom for news stories with sponsors etc.
The basic article will have a square image on the left of the main content. I've coded it so the main image on upload is names the same as the article id.
I was thinking of adding an option to my database for 'bottom images' and have an upload option for when this is set to yes.
What would be the best way to go about this? I'm working in php and mysql.
Any help would be great thanks!
Create a table called:
article_images (id, article_id, image_path, image_type, published, added_datetime)
here, image type will choose what type of image. You can store many rows of image data for a single article. The image type will choose where to put the images: (main image, bottom image, etc...)
Please have a look.
Best way to do is use any WYSIWYG editor like tinyMCE or CKeditor. You wont need to worry about managing imaging separately.