How to structure imgur type posts - php

I would like to add image posts to a website much like Imgur.com
So especially the Image-Text-Image-Text or Text-Image-Image-Text-Image style..
If it was simply Image-Text then I would just have a database table with pictures and their respective captions but this can be any order..
How would I structure a random order of text and pictures in the database while supporting Markdown? A simple push in the right direction is probably enough!

I may be misunderstanding the question but...
If you're looking to upload images to Imgur using your own software/php script, you're going to want to use the Imgur API. You'll have to Register Your Application before you can make use of it.

Related

Fetch Images from URL - Like Facebook Thumbnail

I am building a "Reddit" like site.
The User can post an URL from which I want to get the correct image with PHP.
What I would need is a script which sites like Facebook or Tumblr use to fetch the Images.
I saw already scripts which get the images by getting the HTML Content and searching for "img" tags.
Are there any better methods/scripts available?
Maybe even scripts which will order the images by the size: The bigger the image the more important it is.
Thanks for answers
You may want to check out PHPQuery, it will allow you easily iterate through all images on a given website. You can then work out the areas of each image and sort them accordingly.
It depends a bit for what you're looking for and what the image is that the user would like to have with his post. To give you an example: I once wrote a method that searches for a logo of a company on the company's website. To do so, I searched for, indeed, the img-tags using simple_html_dom and filtered those tags on the existence of logo in the alt-tag. The results are displayed to the user to select the right image; it could be that you find multiple images fitting your purpose.
I would indeed, as you proposed, have a look at the size and skip small images (e.g. smaller dan lets say 50 px).

Dynamic Image Gallery that looks in multiple album folders

Can anyone advise on a great image gallery that's dynamic, client side.
Basically what I want is on my website a gallery with multiple albums and images in the albums. To be able to add images dynamically to the folder or remote site (such as Photobucket or Picasa) and the webapage to be able to display them dynamically without any further coding, avoiding the hassle of having to add a lines of code ever time a new image is added.
Anybody using something like this or can point me in the right direction?
Much appreciated.
I found what I was looking for in Picasa Webalbum Integrator javascript library.
http://code.google.com/p/pwi/

Grabbing images from a Website

I wonder if anyone can point me in the right direction.
I have a rather large spreadsheet of product info that needs plugging into a shop. The tricky bit is that the spreadsheet has a link which points to the relevant page on another site which has the products details, and what i need to do is grab that relevant Image and save locally, so I can use later.The reason Why Im thinking down this line is there are 7500 products....
My friend suggested I could maybe use php & filepopen.
The image does have an outer tag ID which I can refer to.
I was thinking of iterating through the spreadsheet this is the type of link I have to work with
http://www.apc.com/resource/include/techspec_index.cfm?base_sku=APCRBC105
the images themselves are called something random, but I figured I could rename them as I grab them to the more relevant SKU number.
so iterate through the spreadsheet by SKU number
identify the image by the relevant id on the page (I'm assumming it's
in the same place on every page)
save the image while renaming to the correct SKU number
Any ideas on how I could go about this ? the thought of visiting each page manually and saving the image 7500 times doesn't seem the best way forward!
Thanks for looking
Rip the base_sku from your links.
APCRBC105
Then use curl to fetch the image page
http://www.apc.com/products/moreimages.cfm?partnum=APCRBC105
Rip the image link with a regex epression on :
<div align="center">
<img align="center" src="http://www.apcmedia.com/resource/images/500/Front_Left/35531838-5056-9170-D33F24AE47742E6C_pr.jpg" />
</div>
Then use curl again to rip the actual image and save it.
That should work..
If there aren't any issues regarding copyrighted material, take a look at Google Refine.
You can grab content from websites based on your cell values and use them afterwards to build more complex scenarios.
See the screencasts for more info (screencast 3 talks about fetching values via URLs).
Once you have the Image URL's in your spreadsheet, it should be fairly easy to fetch them via curl or similar.

Automated image update with page statistics

Frankly I am not sure where this would go but I assume the way to create what I'm about to describe is PHP... so I'm sorry if it's in the wrong section.
Basically I have a website, using Wordpress, where users can review websites and post a 5 star rating of the site. Each reviewed website has it's own dedicated page.
So what I want to do is create an image from the statistics of the ratings to allow the website owners to place it on their page. The image will need to, when clicked, go to that it's review page.
So the image would be about 150x150. Have the overall 5 Star Rating, the Name of the Reviewed site and the name of my website. It would also be cool if there was some automatically generated HTML embedding code so the site owners can simply copy and paste it.
I hope I explained myself ok. I've tried searching google but I'm not entirely sure what to search for and therefore have found nothing useful.
Thanks.
EDIT
I can create the embed code manually. I just need to really know about how to make the picture update automatically.
Hey what you are asking for is quite complex and it would be to easy to just give you code. So here is some reading for you. Your problem is quite meaty and no doubt you'll learn loads sorting it out....
http://www.phptutorial.info/learn/create_images/
http://www.qualitycodes.com/tutorial.php?articleid=20&title=How-to-create-bar-graph-in-PHP-with-dynamic-scaling
I just need to really know about how
to make the picture update
automatically.
Just put URL to your php-script, which will generate image.
You will need function imagettftext to write text over the image, imagecopy to draw the stars (of votes).
Also, you will need image of a star and background.
So, approx. algorithm will be:
1. Open the background image by imagecreatefrompng - it will be our generated image
2. Open the Star image
3. Write title of the reviewed site by imagetttftext
4. Draw stars by copying existing Star image to our background image (by imagecopy)
5. Print generated image by imagepng

photo gallery in php/jquery

I'm looking for a plugin for photo gallery in php/ jquery/ mysql to get the photos from the database that would look like this:
http://dev.sencha.com/deploy/dev/examples/organizer/organizer.html
Organizing Images into Albums using php/jquery
Anyone?
If I understand correctly, you are looking more at organazing/managing photos than files in general and Coppermine is pretty much just does that.
Coppermine gallery functionality.
"Coppermine stores files inside of
albums, so you'll need at least one
album for your pictures/files to be
placed in. Albums can be stored in
categories (but they don't HAVE to be
in a category, they can just as well
go into the coppermine "root"). When
you click on "albums" in the admin
menu, you will see the Album Manager."
This should do the job I guess:
6 New File Managers Based on jQuery, Ajax, php
Good luck, hope this was what you were looking for!

Categories